Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.9k stars 540 forks source link

When Configure checks the integrity of Perl, running the ls command encounters an error message related to “grep: warning: stray \ before -.” This causes Configure to mistakenly judge the package as incomplete #22398

Open hongjinghao opened 1 month ago

hongjinghao commented 1 month ago

Module:

Description

The error in the ls command prevents Perl from passing the integrity check

[   57s] + /bin/sh Configure -des -Doptimize=none '-Dccflags=-O2 -g -grecord-gcc-switches -pipe -fstack-protector-strong  -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/generic-hardened-cc1 -fasynchronous-unwind-tables -fstack-clash-protection' '-Dldflags=-Wl,-z,relro   -Wl,-z,now -specs=/usr/lib/rpm/generic-hardened-ld' '-Dccdlflags=-Wl,--enable-new-dtags -Wl,-z,relro   -Wl,-z,now -specs=/usr/lib/rpm/generic-hardened-ld' '-Dlddlflags=-shared -Wl,-z,relro   -Wl,-z,now -specs=/usr/lib/rpm/generic-hardened-ld' -Dshrpdir=/usr/lib64 -DDEBUGGING=-g -Dversion=5.38.0 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl5 -Dprivlib=/usr/share/perl5 -Dsitearch=/usr/local/lib64/perl5 -Dvendorlib=/usr/share/perl5/vendor_perl -Darchlib=/usr/lib64/perl5 -Dvendorarch=/usr/lib64/perl5/vendor_perl -Darchname=aarch64-linux-thread-multi '-Dlibpth=/usr/local/lib64 /lib64 /usr/lib64' -Duseshrplib -Dusethreads -Duseithreads -Ui_ndbm -Di_gdbm -Dusedtrace=/usr/bin/dtrace -Ubincompat5005 -Dusesitecustomize -Duselargefiles -Dd_semctl_semun -Di_db -Duse64bitint -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dscriptdir=/usr/bin -Dinstallusrbinperl=n -Uversiononly '-Dpager=/usr/bin/less -isr' -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto
[   58s] First let's make sure your kit is complete.  Checking...
[   60s] grep: warning: stray \ before -
..............
..............
..............
[   60s] grep: warning: stray \ before -
[   60s] 
[   60s] THIS PACKAGE SEEMS TO BE INCOMPLETE.
[   60s] 
[   60s] You have the option of continuing the configuration process, despite the
[   60s] distinct possibility that your kit is damaged, by typing 'y'es.  If you
[   60s] do, don't blame me if something goes wrong.  I advise you to type 'n'o
[   60s] and contact the author (https://github.com/Perl/perl5/issues).
[   60s] 
[   60s] Continue? [n] ABORTING...

Steps to Reproduce

/bin/sh Configure -des -Doptimize=none '-Dccflags=-O2 -g -grecord-gcc-switches -pipe -fstack-protector-strong  -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/generic-hardened-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection ' '-Dldflags=-Wl,-z,relro   -Wl,-z,now -specs=/usr/lib/rpm/generic-hardened-ld' '-Dccdlflags=-Wl,--enable-new-dtags -Wl,-z,relro   -Wl,-z,now -specs=/usr/lib/rpm/generic-hardened-ld' '-Dlddlflags=-shared -Wl,-z,relro   -Wl,-z,now -specs=/usr/lib/rpm/generic-hardened-ld' -Dshrpdir=/usr/lib64 -DDEBUGGING=-g -Dversion=5.38.0 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl5 -Dprivlib=/usr/share/perl5 -Dsitearch=/usr/local/lib64/perl5 -Dvendorlib=/usr/share/perl5/vendor_perl -Darchlib=/usr/lib64/perl5 -Dvendorarch=/usr/lib64/perl5/vendor_perl -Darchname=x86_64-linux-thread-multi '-Dlibpth=/usr/local/lib64 /lib64 /usr/lib64' -Duseshrplib -Dusethreads -Duseithreads -Ui_ndbm -Di_gdbm -Dusedtrace=/usr/bin/dtrace -Ubincompat5005 -Dusesitecustomize -Duselargefiles -Dd_semctl_semun -Di_db -Duse64bitint -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dscriptdir=/usr/bin -Dinstallusrbinperl=n -Uversiononly '-Dpager=/usr/bin/less -isr' -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto

Expected behavior

The integrity check for Perl should not rely on the correctness or error of the ls ; it should only verify whether the file exists Perl configuration

# perl -V output goes here
5.38.0
hongjinghao commented 1 month ago

Is it possible to replace ls with -e in the Configure to check if files exist?

Leont commented 1 month ago

The error in the ls command prevents Perl from passing the integrity check

I'm not sure where that conclusion comes from? That error is strongly suggesting it comes from grep not ls.

Can you try to check if any of the many arguments you pass to Configure is related to this?

haarg commented 1 month ago

I don't see anything in that part of Configure calling grep.

jkeenan commented 1 month ago

Module:

Description

The error in the ls command prevents Perl from passing the integrity check


[   57s] + /bin/sh Configure -des -Doptimize=none '-Dccflags=-O2 -g -grecord-gcc-switches -pipe -fstack-protector-strong  -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/generic-hardened-cc1 -fasynchronous-unwind-tables -fstack-clash-protection' '-Dldflags=-Wl,-z,relro   -Wl,-z,now -specs=/usr/lib/rpm/generic-hardened-ld' '-Dccdlflags=-Wl,--enable-new-dtags -Wl,-z,relro   -Wl,-z,now -specs=/usr/lib/rpm/generic-hardened-ld' '-Dlddlflags=-shared -Wl,-z,relro   -Wl,-z,now -specs=/usr/lib/rpm/generic-hardened-ld' -Dshrpdir=/usr/lib64 -DDEBUGGING=-g -Dversion=5.38.0 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl5 -Dprivlib=/usr/share/perl5 -Dsitearch=/usr/local/lib64/perl5 -Dvendorlib=/usr/share/perl5/vendor_perl -Darchlib=/usr/lib64/perl5 -Dvendorarch=/usr/lib64/perl5/vendor_perl -Darchname=aarch64-linux-thread-multi '-Dlibpth=/usr/local/lib64 /lib64 /usr/lib64' -Duseshrplib -Dusethreads -Duseithreads -Ui_ndbm -Di_gdbm -Dusedtrace=/usr/bin/dtrace -Ubincompat5005 -Dusesitecustomize -Duselargefiles -Dd_semctl_semun -Di_db -Duse64bitint -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dscriptdir=/usr/bin -Dinstallusrbinperl=n -Uversiononly '-Dpager=/usr/bin/less -isr' -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto

@hongjinghao, you are using an enormous number of switches to your invocation of ./Configure. At the same time, you have provided us with no information about the platform on which you are attempting to build perl. This makes it extremely difficult for us to diagnose the problem.

I would recommend that (a) provide us with that system information; and (b) that you start out with a simple invocation like this:

sh ./Configure -des

... and then add other switches one at a time until ./Configure breaks in the way you describe above. For instance, the following switches are often used, singly or in combination, in configuring a perl build:

-Dusethreads
-DDEBUGGING
-Duse64bitint
...
hongjinghao commented 1 month ago

The error in the ls command prevents Perl from passing the integrity check

I'm not sure where that conclusion comes from? That error is strongly suggesting it comes from grep not ls.

Can you try to check if any of the many arguments you pass to Configure is related to this?

I’m also puzzled why using ls triggers a warning related to grep. I wonder if checking the integrity of Perl relies on ls . If ls fails due to reasons other than missing files, this could lead to false positives.

hongjinghao commented 1 month ago

I don't see anything in that part of Configure calling grep.

Yes, I also didn’t see any grep in Perl integrity check during Configure. However, when I executed the command without the ls part, there were no warnings.

    for filelist in x??; do
       (cd "$rsrc"; cat "$tmppwd/$filelist" \
           >/dev/null 2>>"$tmppwd/missing")
    done

It’s possible that this behavior is related to my environment. As for validating Perl integrity, is it really necessary to use ls? If the sole purpose using ls is to confirm file existence,. Can we use -e as a replacement?

Leont commented 1 month ago

@Tux you have any ideas?