bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Bad sed expression in bootstrap.bat


From: Giangiacomo Zaffini
Subject: Re: [PATCH] Bad sed expression in bootstrap.bat
Date: Sun, 25 Dec 2022 02:29:19 +0100

I successfully tested modified bootstrap.bat on both Windows command line and Windows PowerShell (PSVersion 7.2.6)
with sed.exe (GNU sed) 4.8 that is the latest on Windows according to the used installer scoop.

```
PS C:\Users\gzaff\Devs\make> .\bootstrap.bat
-- Downloading Gnulib modules
-- Configuring the workspace
- Creating Basic.mk
- Creating src\mkconfig.h
- Creating src\gmk-default.h

Done.  Run build_w32.bat to build GNU make.
PS C:\Users\gzaff\Devs\make> .\build_w32.bat --without-guile tcc

Creating GNU Make for Windows 9X/NT/2K/XP/Vista/7/8/10

- Building without Guile
- Building with TinyC
- Enabling maintainer mode

tcc version 0.9.27 (x86_64 Windows)

Compiling .\TccRel version
        1 file(s) copied.
        1 file(s) copied.
        1 file(s) copied.
- Compiling src/ar.c
- Compiling src/arscan.c
- Compiling src/commands.c
- Compiling src/default.c
- Compiling src/dir.c
- Compiling src/expand.c
- Compiling src/file.c
- Compiling src/function.c
- Compiling src/getopt.c
- Compiling src/getopt1.c
- Compiling src/guile.c
- Compiling src/hash.c
- Compiling src/implicit.c
- Compiling src/job.c
- Compiling src/load.c
- Compiling src/loadapi.c
- Compiling src/main.c
- Compiling src/misc.c
- Compiling src/output.c
- Compiling src/read.c
- Compiling src/remake.c
- Compiling src/remote-stub.c
- Compiling src/rule.c
- Compiling src/shuffle.c
- Compiling src/signame.c
- Compiling src/strcache.c
- Compiling src/variable.c
- Compiling src/version.c
- Compiling src/vpath.c
- Compiling src/w32/pathstuff.c
- Compiling src/w32/w32os.c
- Compiling src/w32/compat/posixfcn.c
- Compiling src/w32/subproc/misc.c
- Compiling src/w32/subproc/sub_proc.c
- Compiling src/w32/subproc/w32err.c
In file included from src/w32/subproc/w32err.c:19:
./src/makeint.h:409: warning: WIN32_LEAN_AND_MEAN redefined
- Compiling lib/fnmatch.c
- Compiling lib/glob.c
- Compiling lib/getloadavg.c
- Compiling src\w32\compat\dirent.c

- Linking ./TccRel/gnumake.exe

.\TccRel build succeeded.
        1 file(s) copied.
PS C:\Users\gzaff\Devs\make> sed --version
C:\Users\gzaff\scoop\apps\sed\current\sed.exe (GNU sed) 4.8
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Jay Fenlason, Tom Lord, Ken Pizzini,
Paolo Bonzini, Jim Meyering, and Assaf Gordon.

This sed program was built without SELinux support.

GNU sed home page: <https://www.gnu.org/software/sed/>.
General help using GNU software: <https://www.gnu.org/gethelp/>.
E-mail bug reports to: <bug-sed@gnu.org>.
Patched (v2) by: Michael M. Builov <mbuilov@gmail.com>.
PS C:\Users\gzaff\Devs\make> $PsVersionTable

Name                           Value
----                           -----
PSVersion                      7.2.6
PSEdition                      Core
GitCommitId                    7.2.6
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
```

I cannot see where
sed -e "s/$/ \\/"
can be wrong on Windows command line or Windows PowerShell.

On the other hand, as reported, it is true that original sed command is correct on MSYS/mingw64/mingw32

```
gzaff@LAPTOP-6HAJ0RG0 MSYS /c/Users/gzaff/Devs/make
$ echo static const char *const GUILE_module_defn = \" \\> src/gmk-default.h

gzaff@LAPTOP-6HAJ0RG0 MSYS /c/Users/gzaff/Devs/make
$ cat src/gmk-default.h
static const char *const GUILE_module_defn = " \

gzaff@LAPTOP-6HAJ0RG0 MSYS /c/Users/gzaff/Devs/make
$ sed -e "s/;.*//" -e "/^[ \t]*$/d" -e "s/\"/\\\\\"/g" -e "s/$/ \\/" src/gmk-default.scm >> src/gmk-default.h
sed: -e _expression_ #4, char 7: unterminated `s' command

gzaff@LAPTOP-6HAJ0RG0 MSYS /c/Users/gzaff/Devs/make
$ sed -e "s/;.*//" -e "/^[ \t]*$/d" -e "s/\"/\\\\\"/g" -e "s/$/ \\\/" src/gmk-default.scm >> src/gmk-default.h

gzaff@LAPTOP-6HAJ0RG0 MSYS /c/Users/gzaff/Devs/make
$ sed --version
sed (GNU sed) 4.7
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Jay Fenlason, Tom Lord, Ken Pizzini,
Paolo Bonzini, Jim Meyering, and Assaf Gordon.
GNU sed home page: <https://www.gnu.org/software/sed/>.
General help using GNU software: <https://www.gnu.org/gethelp/>.
E-mail bug reports to: <bug-sed@gnu.org>.

gzaff@LAPTOP-6HAJ0RG0 MSYS /c/Users/gzaff/Devs/make
$
```

I don't know, maybe understanding if bootstrap.bat is running under
MSYS2/mingw64/mingw32 bash
or 
Windows command line/Windows PowerShell 
and use correct sed syntax for the case ?

Giangiacomo

Il giorno sab 24 dic 2022 alle ore 17:32 Paul Smith <psmith@gnu.org> ha scritto:
On Thu, 2022-12-22 at 18:17 +0100, Giangiacomo Zaffini wrote:
> C:\Users\gzaff\scoop\apps\sed\current\sed.exe: -e _expression_ #4, char
> 9: unterminated `s' command

Someone else mentioned this a week or so ago.

Interestingly, this works fine with the version of sed I have installed
(the version that comes with Git for Windows):

  sed (GNU sed) 4.9

And the replacement version you suggest shows an error:

  sed: -e _expression_ #4, char 7: unterminated `s' command

Note I am running this in cmd.exe.  Maybe you are running in PowerShell
and the quoting is different, or something?

Very confusing.


--
il riposo dopo il lavoro

reply via email to

[Prev in Thread] Current Thread [Next in Thread]