osdir.com
mailing list archive F.A.Q. -since 2001!



Subject: RE: RE: Bug with backticks behaviour in mSYS? -
msg#00015

List: gnu.mingw.msys

Mail Archive Navigation:
by Date: Prev Next Date Index by Thread: Prev Next Thread Index

Mark Cave-Ayland wrote, quoting Luke Dunstan:
>> The "bash" command you are using is not part of MSYS, so it is
>> probably Cygwin bash or something.
>
> The machine I am using MingW/MSys with is 100% cygwin clean, so it
> must be something that comes with MingW/MSys/Msys-DTK... I also tried
> upgrading to the latest candidate of bash from the releases page to
> see what effect that would also have.

Mark,

We don't distribute bash with any standard MinGW/MSYS/msysDTK package;
(or rather we *do*, but we call it sh.exe, so it runs in its POSIX
compatibility mode). You *must* have acquired your bash from some
other source, unless you are referring to the bash-2.05b-MSYS.tar.bz2
appearing in the MSYS snapshot section of the download page -- and
you should note that snapshots may not be stable.

IIRC, this snapshot was provided to kludge any environment variable
named `prefix' to represent a native Win32 path, even if specified
with MSYS semantics; this was to co-operate more effectively with
autoconf, but it has since been established that there is a *much*
more effective method of achieving the desired goal. In any case,
that snapshot of bash was intended to be installed as /bin/sh.exe

Using the standard MSYS sh.exe, from MSYS-1.0.10.exe, and also using
"correct" portable command quoting, I can't reproduce the failure
of your original simple test case:

<file name="test.c">
#include <stdio.h>

main()
{
printf("this is a test string\n");
}
</file>

<commands>
gcc -o test test.c
sh -c 'echo `./test`" -lpd" > x.x'
od -cb x.x
</commands>

<output>
0000000 t h i s i s a t e s t s
164 150 151 163 040 151 163 040 141 040 164 145 163 164 040 163
0000020 t r i n g - l p q \n
164 162 151 156 147 040 055 154 160 161 012
0000033
</output>

(This output is reproduced identically, if I rename sh.exe as bash.exe,
and adjust the appropriate command accordingly, so even without the
POSIX compatibility mode turned on, I can't reproduce the failure).

You should avoid using backtick substitution within quoted command
arguments; it isn't *generally* a problem with bash, but some shells
-- notably some of the BSD shells -- mishandle them. And, in this case,
I *can* identically reproduce your failure when I use improper quoting,
regardless of whether the shell is called sh.exe or bash.exe, i.e. in:

<commands>
sh -c 'echo "`./test` -lpd" > x.x'
od -cb x.x
</commands>

the backticked command is improperly quoted, and fails *exactly* as you
have described:

<output>
0000000 t h i s i s a t e s t s
164 150 151 163 040 151 163 040 141 040 164 145 163 164 040 163
0000020 t r i n g 001 - l p q \n
164 162 151 156 147 001 040 055 154 160 161 012
0000034
</output>

Regards,
Keith.


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click


Thread at a glance:

Previous Message by Date:

Re: ar.exe & scripts

Florian Schricker wrote: > the lib is actually created with no problems. This also shows that the > above error has nothing to do with permissions as ar can create the lib > in the correct place, but only using a relative path. Now that's what I > call odd! :-/ Why is that odd? 'ar' is a mingw application and it must be given win32 paths. "c:/path" ought to work but "/c/path" will not unless you actually mean a subdirectory "/c" in the root of the current drive. Remember that the whole point of MSYS is to do this path translation for mingw apps, but since 'ar' is reading this file directly there is no way for this translation to happen. So any path you give it must be a valid win32 path. Brian ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click

Next Message by Date:

RE: RE: Bug with backticks behaviour in mSYS?

In his sig, Mark Cave-Ayland wrote: > This email and any attachments are confidential to the intended > recipient and may also be privileged. If you are not the intended > recipient please delete it from your system and notify the sender. > You should not copy it or use it for any purpose nor disclose or > distribute its contents to any other person. This sort of nonsense is utterly inappropriate for any mail posted to a publicly viewable mailing list. For list posts, please use a sig which does not include such rubbish. If this is not possible, because of corporate policy/configuration beyond your control, then please consider using a webmail service which allows you to control such content. Regards, Keith. ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click

Previous Message by Thread:

RE: RE: Bug with backticks behaviour in mSYS?

> -----Original Message----- > From: mingw-msys-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx > [mailto:mingw-msys- > admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx] On Behalf Of Luke > Dunstan > Sent: 02 January 2006 06:11 > To: mingw-msys-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx > Subject: Re: [Mingw-msys] RE: Bug with backticks behaviour in mSYS? > > > The "bash" command you are using is not part of MSYS, so it is probably > Cygwin bash or something. > > Luke Hi Luke, The machine I am using MingW/MSys with is 100% cygwin clean, so it must be something that comes with MingW/MSys/Msys-DTK... I also tried upgrading to the latest candidate of bash from the releases page to see what effect that would also have. Many thanks, Mark. ------------------------ WebBased Ltd 17 Research Way Plymouth PL6 8BT T: +44 (0)1752 797131 F: +44 (0)1752 791023 http://www.webbased.co.uk http://www.infomapper.com http://www.swtc.co.uk This email and any attachments are confidential to the intended recipient and may also be privileged. If you are not the intended recipient please delete it from your system and notify the sender. You should not copy it or use it for any purpose nor disclose or distribute its contents to any other person. ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click

Next Message by Thread:

RE: RE: Bug with backticks behaviour in mSYS?

Quoting Keith MARSHALL <keith.marshall-HB07P1Z8hRUAvxtiuMwx3w@xxxxxxxxxxxxxxxx>: IIRC, this snapshot was provided to kludge any environment variable named `prefix' to represent a native Win32 path, even if specified Uhm, no, the prefix deal is part of the runtime not bash. The bash snapshot is a preliminary release for the newest version of bash. It doesn't work correctly and will need further source work. Earnie ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
blog comments powered by Disqus

Home | News | Sitemap | FAQ | advertise | OSDir is an Inevitable website. GBiz is too!