public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: batch script execution failing with 255 exit code in cygwin 1.7.28
@ 2014-03-21  0:37 Weber, Mark
  0 siblings, 0 replies; 10+ messages in thread
From: Weber, Mark @ 2014-03-21  0:37 UTC (permalink / raw)
  To: cygwin

I am also having some trouble with the latest version of Cygwin, which includes 
this patch.

See
http://cygwin.com/ml/cygwin-patches/2014-q1/msg00017.html
for example.


I am having a related issue, with C++ code that parses the command line.

The command line we support is something like -
  program_name   arg1  -option1=val1  -option2=val2  ...

You get the idea.

Now, with the above mentioned Cygwin patch, we are seeing the input arguments

arg1  "-option1=val1"   "-option2=val2"  ...

If this were the extent of the issue, it would be no big deal to 
strip off the quotes. However, the user may have put quotes on the 
command line himself, which Cygwin now moves around.
Such as:
  program_name  arg1  -option1="file name with spaces in it"

With the patch, is there any way to reliably tell what the user entered 
on the command line?



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: batch script execution failing with 255 exit code in cygwin 1.7.28
  2014-02-17  5:50         ` Prakash Babu
  2014-02-17 13:14           ` Andrey Repin
@ 2014-02-17 14:53           ` Chris J. Breisch
  1 sibling, 0 replies; 10+ messages in thread
From: Chris J. Breisch @ 2014-02-17 14:53 UTC (permalink / raw)
  To: cygwin

Prakash Babu wrote:
>   thanks Christopher.
> I found the following archive which introduced this fix
> (http://cygwin.com/ml/cygwin-patches/2014-q1/msg00017.html)
>

I've read this thread, and I'm not convinced that the path improves the 
behavior. You seem to have traded one inconsistency with another. Before 
there was no way to send a parameter containing an equals sign. Now 
there's no way to treat the equals sign as a delimiter.

Given that there's no real improvement here, I'd prefer the original 
behavior as it at least has the limited benefit of "working as it always 
has".

-- 
Chris J. Breisch

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: batch script execution failing with 255 exit code in cygwin 1.7.28
  2014-02-17  5:50         ` Prakash Babu
@ 2014-02-17 13:14           ` Andrey Repin
  2014-02-17 14:53           ` Chris J. Breisch
  1 sibling, 0 replies; 10+ messages in thread
From: Andrey Repin @ 2014-02-17 13:14 UTC (permalink / raw)
  To: Prakash Babu, cygwin

Greetings, Prakash Babu!

>  thanks Christopher.
> I found the following archive which introduced this fix
> (http://cygwin.com/ml/cygwin-patches/2014-q1/msg00017.html)

> I feel this causes an inconsistent behavior when batch scripts are
> executed using command interpreter(cmd.exe) and cygwin.
> There are some generic batch script we might give to users where some
> might execute using cmd.exe and some using cygwin(especially remotely
> using ssh) and I would be expecting the same behavior in both places.

> Also my existing batch script handles argument a=b in a way where I
> obtain 'a' using %1 and 'b' using %2 and this behavior is broken now.

I would suggest using bash instead of cmd.
Since you are running SSH anyway, you are likely to have bash, too.
As powerful CMD is, it's cumbersome to use, and nowhere near as powerful, as
POSIX shell, not to mention full power of BASH.


--
WBR,
Andrey Repin (anrdaemon@yandex.ru) 17.02.2014, <09:44>

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: batch script execution failing with 255 exit code in cygwin 1.7.28
  2014-02-17  4:46       ` Christopher Faylor
@ 2014-02-17  5:50         ` Prakash Babu
  2014-02-17 13:14           ` Andrey Repin
  2014-02-17 14:53           ` Chris J. Breisch
  0 siblings, 2 replies; 10+ messages in thread
From: Prakash Babu @ 2014-02-17  5:50 UTC (permalink / raw)
  To: cygwin

 thanks Christopher.
I found the following archive which introduced this fix
(http://cygwin.com/ml/cygwin-patches/2014-q1/msg00017.html)

I feel this causes an inconsistent behavior when batch scripts are
executed using command interpreter(cmd.exe) and cygwin.
There are some generic batch script we might give to users where some
might execute using cmd.exe and some using cygwin(especially remotely
using ssh) and I would be expecting the same behavior in both places.

Also my existing batch script handles argument a=b in a way where I
obtain 'a' using %1 and 'b' using %2 and this behavior is broken now.


thanks,
Prakash

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: batch script execution failing with 255 exit code in cygwin 1.7.28
  2014-02-17  3:56     ` Christopher Faylor
@ 2014-02-17  4:46       ` Christopher Faylor
  2014-02-17  5:50         ` Prakash Babu
  0 siblings, 1 reply; 10+ messages in thread
From: Christopher Faylor @ 2014-02-17  4:46 UTC (permalink / raw)
  To: cygwin

On Sun, Feb 16, 2014 at 10:35:32PM -0500, Christopher Faylor wrote:
>On Mon, Feb 17, 2014 at 08:05:45AM +0530, Prakash Babu wrote:
>>Was there any reason why just =(equalto) was removed as a command line
>>separator for cygwin 1.7.28 , while the other delimiters like comma
>>are still supported ? This is causing existing batch files that use
>>equalto(=) as a command line delimiter to fail with cygwin 1.7.28
>
>Search the archives.

Specifically, the cygwin-patches archives.

cgf

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: batch script execution failing with 255 exit code in cygwin 1.7.28
  2014-02-17  3:35   ` Prakash Babu
@ 2014-02-17  3:56     ` Christopher Faylor
  2014-02-17  4:46       ` Christopher Faylor
  0 siblings, 1 reply; 10+ messages in thread
From: Christopher Faylor @ 2014-02-17  3:56 UTC (permalink / raw)
  To: cygwin

On Mon, Feb 17, 2014 at 08:05:45AM +0530, Prakash Babu wrote:
>Was there any reason why just =(equalto) was removed as a command line
>separator for cygwin 1.7.28 , while the other delimiters like comma
>are still supported ? This is causing existing batch files that use
>equalto(=) as a command line delimiter to fail with cygwin 1.7.28

Search the archives.

cgf

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: batch script execution failing with 255 exit code in cygwin 1.7.28
  2014-02-14 15:28 ` Christopher Faylor
@ 2014-02-17  3:35   ` Prakash Babu
  2014-02-17  3:56     ` Christopher Faylor
  0 siblings, 1 reply; 10+ messages in thread
From: Prakash Babu @ 2014-02-17  3:35 UTC (permalink / raw)
  To: cygwin

thanks Christopher for your response.

This is the observation I made wrt to the command line delimiters for
batch files.

cmd.exe delimiters
==============
space,
equalto(=)
semicolon (;)
comma(,)

cygwin 1.7.27 delimiters
==================
space
quotes("")
equalto(=)
comma(,)

cygwin 1.7.28 delimiters
===================
space
quotes("")
comma(,)
equalto(=) not supported

Was there any reason why just =(equalto) was removed as a command line
separator for cygwin 1.7.28 , while the other delimiters like comma
are still supported ? This is causing existing batch files that use
equalto(=) as a command line delimiter to fail with cygwin 1.7.28

thanks,
Prakash

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: batch script execution failing with 255 exit code in cygwin 1.7.28
  2014-02-14  7:05 Prakash Babu
  2014-02-14  8:58 ` Andrey Repin
@ 2014-02-14 15:28 ` Christopher Faylor
  2014-02-17  3:35   ` Prakash Babu
  1 sibling, 1 reply; 10+ messages in thread
From: Christopher Faylor @ 2014-02-14 15:28 UTC (permalink / raw)
  To: cygwin

On Fri, Feb 14, 2014 at 12:10:00PM +0530, Prakash Babu wrote:
>Hi ,
>
>
>I use Cygwin to execute batch scripts on remote windows hosts using ssh.
>
>The batch script execution started failing with the latest cygwin
>version 1.7.28.
>
>The exit code thrown is 255 and batch script is not able to process
>the command line arguments.
>
>When I try to print the command line argument(%1)  its printing both
>the argument name and value.
>
>This was working fine with Cygwin 1.7.27 and  looks to be regression in 1.7.28
>
>
>eg. Batch script (test.bat)
>@echo off
>:setArgs
>if ""%1""=="""" goto doneSetArgs
>set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
>echo %1===
>echo %2===
>shift
>shift
>goto setArgs
>:doneSetArgs
>
>
>Cygwin.1.7.27 the output of the script would be
>#./test.bat OS=Win
>OS===
>Win===
>
>Cygwin.1.7.28 the output of the script is
>#./test.bat OS=Win
>"OS=Win"===
>===

Yep.  At a user's request we now force a " around parameters which are passed to
Windows programs like we do for parameters with spaces.

cgf

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: batch script execution failing with 255 exit code in cygwin 1.7.28
  2014-02-14  7:05 Prakash Babu
@ 2014-02-14  8:58 ` Andrey Repin
  2014-02-14 15:28 ` Christopher Faylor
  1 sibling, 0 replies; 10+ messages in thread
From: Andrey Repin @ 2014-02-14  8:58 UTC (permalink / raw)
  To: Prakash Babu, cygwin

Greetings, Prakash Babu!

> I use Cygwin to execute batch scripts on remote windows hosts using ssh.

> The batch script execution started failing with the latest cygwin
> version 1.7.28.

> The exit code thrown is 255 and batch script is not able to process
> the command line arguments.

> When I try to print the command line argument(%1)  its printing both
> the argument name and value.

And how do you invoke the command?...

> This was working fine with Cygwin 1.7.27 and  looks to be regression in 1.7.28


> eg. Batch script (test.bat)

You should REALLY learn the language you are writing your scripts in before
reporting errors to third parties.

> @echo off
> :setArgs
> if ""%1""=="""" goto doneSetArgs

if "%~1" == "" goto :label

References: goto /?, call /?

> set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
> echo %1===
> echo %2===
> shift
> shift
> goto setArgs
> :doneSetArgs


> Cygwin.1.7.27 the output of the script would be
> #./test.bat OS=Win
> OS===
> Win===

> Cygwin.1.7.28 the output of the script is
> #./test.bat OS=Win
> "OS=Win"===
> ===


> Is this a known issue ?
> Where can I download Cygwin 1.7.27  until I find a workaround/fix to
> this issue ?

Fix is simple - don't use bogus semantics when calling batch scripts.
It took me some time to find vague confirmation, that semicolon and equal sign
are valid parameter delimiters, but no direct statement or explanation of
reason behind this retardedness. 


--
WBR,
Andrey Repin (anrdaemon@yandex.ru) 14.02.2014, <11:17>

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* batch script execution failing with 255 exit code in cygwin 1.7.28
@ 2014-02-14  7:05 Prakash Babu
  2014-02-14  8:58 ` Andrey Repin
  2014-02-14 15:28 ` Christopher Faylor
  0 siblings, 2 replies; 10+ messages in thread
From: Prakash Babu @ 2014-02-14  7:05 UTC (permalink / raw)
  To: cygwin

Hi ,


I use Cygwin to execute batch scripts on remote windows hosts using ssh.

The batch script execution started failing with the latest cygwin
version 1.7.28.

The exit code thrown is 255 and batch script is not able to process
the command line arguments.

When I try to print the command line argument(%1)  its printing both
the argument name and value.

This was working fine with Cygwin 1.7.27 and  looks to be regression in 1.7.28


eg. Batch script (test.bat)
@echo off
:setArgs
if ""%1""=="""" goto doneSetArgs
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
echo %1===
echo %2===
shift
shift
goto setArgs
:doneSetArgs


Cygwin.1.7.27 the output of the script would be
#./test.bat OS=Win
OS===
Win===

Cygwin.1.7.28 the output of the script is
#./test.bat OS=Win
"OS=Win"===
===


Is this a known issue ?
Where can I download Cygwin 1.7.27  until I find a workaround/fix to
this issue ?

thanks,
Prakash

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-03-20 22:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-21  0:37 batch script execution failing with 255 exit code in cygwin 1.7.28 Weber, Mark
  -- strict thread matches above, loose matches on Subject: below --
2014-02-14  7:05 Prakash Babu
2014-02-14  8:58 ` Andrey Repin
2014-02-14 15:28 ` Christopher Faylor
2014-02-17  3:35   ` Prakash Babu
2014-02-17  3:56     ` Christopher Faylor
2014-02-17  4:46       ` Christopher Faylor
2014-02-17  5:50         ` Prakash Babu
2014-02-17 13:14           ` Andrey Repin
2014-02-17 14:53           ` Chris J. Breisch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).