X-Recipient: archive-cygwin AT delorie DOT com X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 02B453856DE5 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=nifty.ne.jp Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=nifty.ne.jp DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-01.nifty.com 26DEcXFS007847 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp; s=dec2015msa; t=1657723113; bh=zKeAyDjn6f0eMi4M2fG30FPhgzW8VycuLflIwhpxPJM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=na2olbv+lSODo4oarphjlqRF+k4NFUqiAnmvTDNrBsE0ssFfTT9Wi9Zr7yAadTqJ9 g6u1kGoe/t5RxfPiybnNOMp5DrPzs6Y9USWW9LC9vDHhELSojxBc4ym9dGK7ISqf+N wiSDx6FZ+iYU3orCuRB9m9Mwng1vKZkiOtkdfvT+2jM2/cTbmpVfEb6zlESNNAtdWW gny5K24HX+Zn4ZEKh7rMua8KnY1MmxQv2GxdHkYsmtnqo2nommmCY60uz3VEEDUpq0 M5yOaeMalUXGBHhRCM371jf1s9uw4ergNHsoXOGq9oWqlWpE9V5zYgQ7hj1OYuu/TD lhcJYqQuPsq3g== X-Nifty-SrcIP: [119.150.44.95] Date: Wed, 13 Jul 2022 23:38:33 +0900 From: Takashi Yano To: "'cygwin AT cygwin DOT com'" Subject: Re: scp command fails to transfer file and returns 1. Message-Id: <20220713233833.96744de926432f10ab45bd22@nifty.ne.jp> In-Reply-To: References: X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_50, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, WEIRD_QUOTING autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "suzuki DOT masaomi AT fujitsu DOT com" , "'soft-mpop-qqm AT ml DOT css DOT fujitsu DOT com'" Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" On Wed, 13 Jul 2022 07:41:25 +0000 > Cygwin$B%5%]!<%H(B $B$4C4EvMM(B > > $B$*@$OC$K$J$C$F$*$j$^$9!#(B > $BD@!!%F%$$G$9!#(B > > $B2<5-$NLdBj$N2r7h$K$D$$$F!"$46(NO$r$*4j$$$7$^$9!#(B > > $B"#4D6-(B > OS: Windows Server 2019 > $B!!(BCygwin$B%P!<%8%g%s(B: 3.3.5 > > $B"#LdBj$,5/$-$?GX7J(B > $B!!EvJ}$N%"%W%j%1!<%7%g%s%W%m%0%i%`$G$O!"%j%b!<%H%7%9%F%`(B(OS: Linux)$B$X(B > $B!!(BSSH$BDL?.$d%U%!%$%kE>Aw$r9T$&L\E*$G!"(BCygwin$B$K4^$^$l$k(Bssh, scp$B%3%^%s%I$r(B > $B!!;R%W%m%;%9$H$7$F $B!!"(ZFbMF$N>\:Y$O!"(B"$B"#EvJ}$N%"%W%j%1!<%7%g%s%W%m%0%i%`(B"$B$r;2>H(B > $B!!"(;vA0=`Hw$H$7$F!"(BSSH$B8x3+80$r AT _Dj$7!"%Q%9%o!<%I$NLd$$9g$o$;L5$7$G(B > $B!!!!(BSSH$B@\B3$G$-$k$3$H$r3NG'$7$F$$$^$9!#(B > > $B"#LdBj$NFbMF(B > $B!!(BURL(https://www.cygwin.com/)$B$+$i%@%&%s%m!<%I$7$?:G?7%P!<%8%g%s(B(3.3.5)$B$N(B > $B!!(BCygwin$B$r(BOS$B$KF3F~$7$?8e!"EvJ}$N%"%W%j%1!<%7%g%s%W%m%0%i%`$r $B!!(Bscp$B%3%^%s%I$OKh2s!"La$jCM(B"1"$B$GI|5"$7!"%U%!%$%kE>Aw$,<:GT$7$^$9!#(B > > $B!!EvJ}$N%"%W%j%1!<%7%g%s%W%m%0%i%`$r%G%P%C%/$7$?7k2L!"(B > $B!!(Bscp$B%3%^%s%I$O2<5-$N%a%C%;!<%8$rJV5Q$7$F$$$^$7$?!#(B > > $B!!(B/usr/bin/scp: dest open ""/tmp/a"": No such file or directory > $B!!(B/usr/bin/scp: failed to upload file /cygdrive//C/test/a to "/tmp/a" > > $B"#LdBj$NJdB-(B > $B!!!&(Bscp$B%3%^%s%I$r!"EvJ}$N%"%W%j%1!<%7%g%s%W%m%0%i%`$+$i;R%W%m%;%9$H$7$F(B > $B!!!!@\E*$K(B > $B!!!!l9g$O!"La$jCM(B"0"$B$GI|5"$7!"%U%!%$%kE>Aw$O AT DOT 8y$7$^$9!#(B > > $B!!!&5l%P!<%8%g%s(B(3.2.0)$B$N(BCygwin$B$rF1$8(BOS$B$KF3F~$7$?8e!"(B > $B!!!!EvJ}$N%"%W%j%1!<%7%g%s%W%m%0%i%`$rl9g$O!"(Bscp$B%3%^%s%I$O(B > $B!!!!La$jCM(B"0"$B$GI|5"$7!"%U%!%$%kE>Aw$O AT DOT 8y$7$^$9!#(B > > $B!!0J>e$N$3$H$+$i!"2f!9$O!":G?7%P!<%8%g%s(B(3.3.5)$B$H5l%P!<%8%g%s(B(3.2.0)$B$N(B > $B!!(BCygwin$B$G!"(Bscp$B%3%^%s%I$NF0:n;EMM$K2?$i$+$NHs8_49$,$"$k$N$G$O$J$$$+!"$H(B > $B!!?dB,$7$F$$$^$9!#(B > > $B"#0MMj;v9`(B > $B!!>e5-$NLdBj$KBP$7$F!"9M$($i$l$k860x$*$h$SBP=hJ}K!$O$"$j$^$9$+!)(B > > $B!c2sEz AT h!d(B > $B!!!!(Bsoft-mpop-qqm AT ml DOT css DOT fujitsu DOT com > > $B"#EvJ}$N%"%W%j%1!<%7%g%s%W%m%0%i%`(B > $B!!!&;R%W%m%;%9$N $B!!!!(BWindows API$B$N(BCreateProcess()$B$r0J2<$NMM$K;HMQ$7!";R%W%m%;%9$r > $B!!(BCreateProcess(NULL, > fullPathCmd,$B!!!!(B/* ssh,scp$B$N(Bcommond line */ > NULL, /* process security attributes */ > NULL, /* primary thread security attributes */ > TRUE, /* handles are inherited */ > NORMAL_PRIORITY_CLASS|CREATE_NO_WINDOW, /* creation flags */ > NULL, /* use parent's environment */ > NULL, /* use parent's current directory */ > &si, /* STARTUPINFO pointer */ > &pi); /* receives PROCESS_INFORMATION */ > > $B!!!&(Bssh$B%3%^%s%I$r $B!!!!>e5-$K<($7$?(BCreateProcess()$B$NBh#2%Q%i%a%?(BfullPathCmd$B$r!"0J2<$NMM$K(B > $B!!!!;XDj$7$F$$$^$9!#(B > > $B!!!!(B\bin\ssh.exe -q -l root -p 22 $B%[%9%HL>(B "echo aaa && /bin/sh -c \"/bin/uname -n\"" > > $B!!!&(Bscp$B%3%^%s%I$r $B!!!!>e5-$K<($7$?(BCreateProcess()$B$NBh#2%Q%i%a%?(BfullPathCmd$B$r!"0J2<$NMM$K(B > $B!!!!;XDj$7$F$$$^$9!#(B > $B!!!!(B > $B!!!!(B\bin\scp.exe "/cygdrive//C/test/a" "root"@$B%[%9%HL>(B:""/tmp/a"" > > > $B0J>e!"$h$m$7$/$*4j$$$7$^$9!#(B > > > $B0J9_$O1QLuJ8>O$G$9!#(B > ****************************************************************** > Cygwin Support Dear Representatives > > Thank you for your support. > I am Shen Ting. > > We ask for your cooperation in solving the following problem. > > $B"#(BEnvironment > OS: Windows Server 2019 > $B!!(BCygwin Version : 3.3.5 > > $B"#(BBackground of the problem > In our application program, for the purpose of SSH communication and file transfer to a remote system (OS: Linux), > the ssh and scp commands included in Cygwin are executed as child processes. > (*) For details of the demonstration contents, refer to "$B"#(BOur Application Program" > (*)As a preliminary preparation, we set the SSH public key and > confirm that we can connect to SSH without inquiring about the password. > > $B"#(BThe problem > In the OS, after installing the latest version (3.3.5) of Cygwin downloaded from the URL(https://www.cygwin.com/), > when we execute our application program, the scp command returns "1" every time, and the file transfer fails. > > As a result of debugging our application program, the scp command returned the following message. > > $B!!(B/usr/bin/scp: dest open ""/tmp/a"": No such file or directory > $B!!(B/usr/bin/scp: failed to upload file /cygdrive//C/test/a to "/tmp/a" > > $B"#(BProblem supplement > $B!&(BIf the scp command is executed directly from the command prompt or Cygwin Bash Shell > instead of being executed from our application program as a child process, > "0" will be returned and the file transfer will succeed. > > $B!&(BIf we execute our application program after introducing the old version Cygwin(3.2.0) to the same OS, > the scp command will return "0" and the file transfer will be successful. > > From the above, we speculate that there may be some incompatibility in the operating specifications of > the scp command in the latest version Cygwin(3.3.5) and the old version Cygwin(3.2.0). > > $B"#(BRequests > Are there any possible causes and workarounds for the above problem? > > > soft-mpop-qqm AT ml DOT css DOT fujitsu DOT com > > $B"#(BOur Application Program > $B!&(BHow child processes run > Use the Windows API CreateProcess() as follows to execute the child process. > > $B!!(BCreateProcess(NULL, > fullPathCmd,$B!!!!(B/* ssh,scp$B$N(Bcommond line */ > NULL, /* process security attributes */ > NULL, /* primary thread security attributes */ > TRUE, /* handles are inherited */ > NORMAL_PRIORITY_CLASS|CREATE_NO_WINDOW, /* creation flags */ > NULL, /* use parent's environment */ > NULL, /* use parent's current directory */ > &si, /* STARTUPINFO pointer */ > &pi); /* receives PROCESS_INFORMATION */ > > $B!&(BCommand line when executing ssh command > The second parameter of CreateProcess() shown above, fullPathCmd, is specified as follows. > > \bin\ssh.exe -q -l root -p 22 $B%[%9%HL>(B "echo aaa && /bin/sh -c \"/bin/uname -n\"" > > $B!&(BCommand line when executing scp command > The second parameter of CreateProcess() shown above, fullPathCmd, is specified as follows. > > \bin\scp.exe "/cygdrive//C/test/a" "root"@$B%[%9%HL>(B:""/tmp/a"" I cannot reproduce your problem. Could you please provide simple test case in C-lang? -- Takashi Yano -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple