Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2011-12

Paramstr trailing spaces, bug or not?

12 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author
to Joost van der Sluis
Joost van der Sluis wrote 8 lines
Hi all, With this command-line: "fpmake --prefix=bla --baseistall=test" paramstr(1) gives "--prefix=bla ". Thus with the trailing space. Is this a bug or a feature?

It's what the shell has passed on. The paramstr() code doesn't do any parsing on Linux. It returns the elements in argv[]

Michael.

Reply by email

Joost van der Sluis
to Unknown author
Show quoted text 9 lines
> With this command-line: > > "fpmake --prefix=bla --baseistall=test" > > paramstr(1) gives "--prefix=bla ". Thus with the trailing space. Is this > a bug or a feature? It's what the shell has passed on. The paramstr() code doesn't do any parsing on Linux. It returns the elements in argv[]

Most of the time I'm indeed on Linux, but this case it was Windows. But I guess the same thing holds?

Joost.

Reply by email

Sven Barth
to Joost van der Sluis
Joost van der Sluis wrote 13 lines
On Thu, 2011-12-22 at 17:18 +0100, wrote: >> With this command-line: >> >> "fpmake --prefix=bla --baseistall=test" >> >> paramstr(1) gives "--prefix=bla ". Thus with the trailing space. Is this >> a bug or a feature? > > It's what the shell has passed on. The paramstr() code doesn't do any > parsing on Linux. It returns the elements in argv[] Most of the time I'm indeed on Linux, but this case it was Windows. But I guess the same thing holds?

AFAIK it's not the same as on Windows you have a "commandline string" which needs to be parsed by the application.

Regards,
Sven.

Reply by email

Pierre Free Pascal
to Joost van der Sluis: Most of the time I'm indeed on Linux, but this case it was Windows. But I guess the same…
Show quoted text 13 lines
-----Message d'origine----- De : [mailto:fpc-devel- De la part de Joost van der Sluis Envoyé : jeudi 22 décembre 2011 17:36 À : FPC developers' list Objet : Re: [fpc-devel] Paramstr trailing spaces, bug or not? On Thu, 2011-12-22 at 17:18 +0100, wrote: > > With this command-line: > > > > "fpmake --prefix=bla --baseistall=test" > > > > paramstr(1) gives "--prefix=bla ". Thus with the trailing space. Is

this

Show quoted text 7 lines
> > a bug or a feature? > > It's what the shell has passed on. The paramstr() code doesn't do any > parsing on Linux. It returns the elements in argv[] Most of the time I'm indeed on Linux, but this case it was Windows. But I guess the same thing holds?

Hi Jost,
I am completely unable to reproduce this...
on a windows machine!

Futhermore this behavior would break lots of code
including the compiler itself...
Maybe there is some special configuration you are working on that explains this strange behavior...

Which Windows OS version do you use?
Is it a Virtual machine?
What shell are you using?

Pierre Muller

Reply by email

Marco van de Voort
to Pierre Free Pascal

In our previous episode, Pierre Free Pascal said:

Show quoted text 9 lines
> > parsing on Linux. It returns the elements in argv[] > > Most of the time I'm indeed on Linux, but this case it was Windows. But > I guess the same thing holds? I am completely unable to reproduce this... on a windows machine! From the sourcecode, I would suggest something with quotes

something "--prefix=bla "

Reply by email

Joost van der Sluis
to Pierre Free Pascal: this I am completely unable to reproduce this... on a windows machine! Futhermore this…
Pierre Free Pascal wrote 11 lines
I am completely unable to reproduce this... on a windows machine! Futhermore this behavior would break lots of code including the compiler itself... Maybe there is some special configuration you are working on that explains this strange behavior... Which Windows OS version do you use? Is it a Virtual machine? What shell are you using?

What I did was this: 'make install PREFIX=c:\lazarus\fpc\2.7.1\' the trailing backslash is important...

Then make runs (among others) the following command: .\fpmake.exe install --localunitdir=../.. --globalunitdir=.. --os=win32 --cpu=i386 -o -Ur -o -Xs -o -O2 -o -n -o -FuC:/svn/fpc-trunk/rtl/units/i386-win32 -o -FuC:/svn/fpc-trunk/packages/hash/units/i386-win32 -o -FuC:/svn/fpc-trunk/packages/paszlib/units/i386-win32 -o -FuC:/svn/fpc-trunk/packages/fcl-process/units/i386-win32 -o -FuC:/svn/fpc-trunk/packages/fpmkunit/units/i386-win32 -o -FE. -o -FUunits/i386-win32 -o -di386 -o -dRELEASE --compiler=C:/svn/fpc-trunk/compiler/ppc386.exe --prefix=c:\lazarus\fpc\2.7.1\ --unitinstalldir=c:\lazarus\fpc\2.7.1\/units/i386-win32/fcl-base -ie -d

Note the two spaces after the prefix. Which result in the error message that the directory "c:\lazarus\fpc\2.7.1 \bin" coudn't be created. (Note the space)

Can you reproduce that? I tried with a simple hello-world kind of application and in that case I can't reproduce it either.

This is on Windows 7 in a virtual machine. (kvm)

Joost.

Reply by email

Sergei Gorelkin
to Joost van der Sluis

23.12.2011 1:26, Joost van der Sluis пишет:

Show quoted text 16 lines
What I did was this: 'make install PREFIX=c:\lazarus\fpc\2.7.1\' the trailing backslash is important... Then make runs (among others) the following command: .\fpmake.exe install --localunitdir=../.. --globalunitdir=.. --os=win32 --cpu=i386 -o -Ur -o -Xs -o -O2 -o -n -o -FuC:/svn/fpc-trunk/rtl/units/i386-win32 -o -FuC:/svn/fpc-trunk/packages/hash/units/i386-win32 -o -FuC:/svn/fpc-trunk/packages/paszlib/units/i386-win32 -o -FuC:/svn/fpc-trunk/packages/fcl-process/units/i386-win32 -o -FuC:/svn/fpc-trunk/packages/fpmkunit/units/i386-win32 -o -FE. -o -FUunits/i386-win32 -o -di386 -o -dRELEASE --compiler=C:/svn/fpc-trunk/compiler/ppc386.exe --prefix=c:\lazarus\fpc\2.7.1\ --unitinstalldir=c:\lazarus\fpc\2.7.1\/units/i386-win32/fcl-base -ie -d Note the two spaces after the prefix. Which result in the error message that the directory "c:\lazarus\fpc\2.7.1 \bin" coudn't be created. (Note the space) Can you reproduce that? I tried with a simple hello-world kind of application and in that case I can't reproduce it either. This is on Windows 7 in a virtual machine. (kvm)

Just some notes:
- syswin.inc code looks like any number of delimiters between parameters are skipped.
- this extra whitespace is added by the makefile, suggesting some buggy/incorrect processing in make.exe or makefile itself.
- the extra character may be not a whitespace (#32), but something looking like one (e.g. non-breaking space with code #160)

Sergei

Reply by email

Marco van de Voort
to Sergei Gorelkin

In our previous episode, Sergei Gorelkin said:

Show quoted text 11 lines
> the space) > > Can you reproduce that? I tried with a simple hello-world kind of > application and in that case I can't reproduce it either. > > This is on Windows 7 in a virtual machine. (kvm) > Just some notes: - syswin.inc code looks like any number of delimiters between parameters are skipped.

.. unless quoted.

- this extra whitespace is added by the makefile, suggesting some buggy/incorrect processing in make.exe or makefile itself.

It could be that the makefile logic quotes every argument on windows, in case of spaces. We would need a kind of strace tool for Windows to find out.

Reply by email

Sergei Gorelkin
to Marco van de Voort

23.12.2011 16:18, Marco van de Voort пишет:

Show quoted text 11 lines
> - syswin.inc code looks like any number of delimiters between parameters > are skipped. .. unless quoted. > - this extra whitespace is added by the makefile, suggesting some buggy/incorrect processing in > make.exe or makefile itself. It could be that the makefile logic quotes every argument on windows, in case of spaces. We would need a kind of strace tool for Windows to find out.

... it is the trailing backslash escaping the following character (C style). I could reproduce the issue, by using the following command in 'packages' directory:

make install PP=f:\trunk\compiler\ppc386.exe PREFIX="f:\lazarus\fpc\2.7.1\"

Note the quotes, and also note where they end up in output:

make -C fcl-base install
make[1]: Entering directory `F:/trunk/packages/fcl-base' .\fpmake.exe install --localunitdir=../.. --globalunitdir=.. --os=win32 --cpu=i386 -o -Fu../../rtl/units/i386-win32 -o -Fu../../packages/hash/units/i386-win32 -o -Fu../../packages/paszlib/units/i386-win32 -o -Fu../../packages/fcl-process/units/i386-win32 -o -Fu../../packages/fpmkunit/units/i386-win32 -o -FE. -o -FUunits/i386-win32 -o -di386 --compiler=f:/trunk/compiler/ppc386.exe --prefix=f:\lazarus\fpc\2.7.1" --unitinstalldir=f:\lazarus\fpc\2.7.1"/units/i386-win32/fcl-base The installer encountered the following error:
Failed to create directory "f:\lazarus\fpc\2.7.1
--unitinstalldir=f:\lazarus\fpc\2.7.1\units\i386-win32\fcl-base\units\i386-win32\fcl-base\" make[1]: *** [install] Error 1

Without quotes the result is basically the same:

.\fpmake.exe install --localunitdir=../.. --globalunitdir=.. --os=win32 --cpu=i386 -o -Fu../../rtl/units/i386-win32 -o -Fu../../packages/hash/units/i386-win32 -o -Fu../../packages/paszlib/units/i386-win32 -o -Fu../../packages/fcl-process/units/i386-win32 -o -Fu../../packages/fpmkunit/units/i386-win32 -o -FE. -o -FUunits/i386-win32 -o -di386 --compiler=f:/trunk/compiler/ppc386.exe --prefix=f:\lazarus\fpc\2.7.1\ --unitinstalldir=f:\lazarus\fpc\2.7.1\/units/i386-win32/fcl-base The installer encountered the following error:
Failed to create directory "f:\lazarus\fpc\2.7.1
--unitinstalldir=f:\lazarus\fpc\2.7.1\\units\i386-win32\fcl-base\units\i386-win32\fcl-base\"

Finally, when trailing backslash is duplicated, everything runs successfully.

Sergei

Reply by email

Joost van der Sluis
to Sergei Gorelkin
Sergei Gorelkin wrote 14 lines
23.12.2011 16:18, Marco van de Voort пишет: >> - syswin.inc code looks like any number of delimiters between parameters >> are skipped. > > .. unless quoted. > >> - this extra whitespace is added by the makefile, suggesting some buggy/incorrect processing in >> make.exe or makefile itself. > > It could be that the makefile logic quotes every argument on windows, in > case of spaces. We would need a kind of strace tool for Windows to find out. > ... it is the trailing backslash escaping the following character (C style). I could reproduce the issue, by using the following command in 'packages' directory:

So to conclude, it's a problem of make that it handles the backslash as if it were a escaping-backslash. There's nothing that we have to change, except that fpmake has to trim it's input values to handle this buggy make-behavior.

Joost.

Reply by email

Pierre Free Pascal
to Joost van der Sluis
Show quoted text 32 lines
-----Message d'origine----- De : [mailto:fpc-devel- De la part de Joost van der Sluis Envoyé : samedi 24 décembre 2011 14:23 À : FPC developers' list Objet : Re: [fpc-devel] Paramstr trailing spaces, bug or not? On Fri, 2011-12-23 at 17:25 +0400, Sergei Gorelkin wrote: > 23.12.2011 16:18, Marco van de Voort пишет: > >> - syswin.inc code looks like any number of delimiters between parameters > >> are skipped. > > > > .. unless quoted. > > > >> - this extra whitespace is added by the makefile, suggesting some buggy/incorrect processing in > >> make.exe or makefile itself. > > > > It could be that the makefile logic quotes every argument on windows, in > > case of spaces. We would need a kind of strace tool for Windows to find out. > > > ... it is the trailing backslash escaping the following character (C style). > I could reproduce the issue, by using the following command in 'packages' directory: So to conclude, it's a problem of make that it handles the backslash as if it were a escaping-backslash. There's nothing that we have to change, except that fpmake has to trim it's input values to handle this buggy make-behavior.

I don't think that its buggy behavior,
windows make, be it cygwin, mingw32 (and probably also msys) do expect only forward slashes for directory separators and always handles backward slashes as escapes.

Using forward slashes for all parameters of a make call should avoid the problem...
If you really wanted backward slashes, then, simply use escaped backslashes, i.e. two in a row,
make install PREFIX=c:\\lazarus\\fpc\\2.7.1\\

Pierre

Reply by email