public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/28499] New: Couldn't export variable to sub process
@ 2021-10-26 14:40 drvignesh1992 at gmail dot com
  2021-10-26 20:15 ` [Bug libc/28499] " adhemerval.zanella at linaro dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: drvignesh1992 at gmail dot com @ 2021-10-26 14:40 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28499

            Bug ID: 28499
           Summary: Couldn't export variable to sub process
           Product: glibc
           Version: 2.32
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: drvignesh1992 at gmail dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Hi Team,

I am migrating from glibc-2.31 to glibc-2.32 and couldn't export variable's to
child process

Please look into below logs and example code

----
# cat export.sh 
#!/bin/sh

A=5
export A
echo $A
./test.sh
----

----
# cat test.sh 
#!/bin/sh

echo $A
----

Output with glibc-2.31:

# ldd --version
ldd (GNU libc) 2.31
$Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$Written by Roland McGrath and Ulrich Drepper.
#
# ./export.sh 
5
5
#

Output with glibc-2.32:

# ldd --version
ldd (GNU libc) 2.32
$Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$Written by Roland McGrath and Ulrich Drepper.

# ./export.sh 
5

# 

You could see in glibc-2.31 exported variable is printing in the test.sh file
but in case of glibc-2.32 it is not.

Note: all other packages with the rootfs is same, except glibc

Tried using busybox and bash (latest version), but no improvement.

Is there a particular commit which causes this issue, I couldn't found any
release notes related to this.

Thanks in advance.

Regards,
Vignesh

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/28499] Couldn't export variable to sub process
  2021-10-26 14:40 [Bug libc/28499] New: Couldn't export variable to sub process drvignesh1992 at gmail dot com
@ 2021-10-26 20:15 ` adhemerval.zanella at linaro dot org
  2021-10-27 13:40 ` drvignesh1992 at gmail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2021-10-26 20:15 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28499

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1
                 CC|                            |adhemerval.zanella at linaro dot o
                   |                            |rg
   Last reconfirmed|                            |2021-10-26

--- Comment #1 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
At least with bash and dash I could not reproduce it:

$ ./elf/ld.so --version | head -n1
ld.so (GNU libc) development release version 2.34.9000.
$ ./elf/ld.so --library-path . /bin/bash ./export.sh 
5
5
$ ./elf/ld.so --library-path . /bin/dash ./export.sh 
5
5

And on both shells they call fork+exec and we do have tests that rely on forked
process to retains the environment variables (posix/tst-execvpe5.c).  I will
close this bug by the end of the week.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/28499] Couldn't export variable to sub process
  2021-10-26 14:40 [Bug libc/28499] New: Couldn't export variable to sub process drvignesh1992 at gmail dot com
  2021-10-26 20:15 ` [Bug libc/28499] " adhemerval.zanella at linaro dot org
@ 2021-10-27 13:40 ` drvignesh1992 at gmail dot com
  2021-10-27 14:04 ` adhemerval.zanella at linaro dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: drvignesh1992 at gmail dot com @ 2021-10-27 13:40 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28499

--- Comment #2 from Vignesh <drvignesh1992 at gmail dot com> ---
Hi,

Thanks for the reply, 

That works for me too if my binutils version is 2.27 or above

if the binutils is less than 2.27 I am facing the issue.

I kept the binutils 2.25.1 as default and just changed glibc from 2.31 to 2.32.
2.31 works and 2.32 doesn't.

binutils 2.27 is released around 2016 and I hope there should me some
modification made in the glibc from 2.31 to 2.32 on top of that.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/28499] Couldn't export variable to sub process
  2021-10-26 14:40 [Bug libc/28499] New: Couldn't export variable to sub process drvignesh1992 at gmail dot com
  2021-10-26 20:15 ` [Bug libc/28499] " adhemerval.zanella at linaro dot org
  2021-10-27 13:40 ` drvignesh1992 at gmail dot com
@ 2021-10-27 14:04 ` adhemerval.zanella at linaro dot org
  2021-11-01 10:10 ` drvignesh1992 at gmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2021-10-27 14:04 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28499

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |NOTABUG
             Status|WAITING                     |RESOLVED

--- Comment #3 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
(In reply to Vignesh from comment #2)
> Hi,
> 
> Thanks for the reply, 
> 
> That works for me too if my binutils version is 2.27 or above
> 
> if the binutils is less than 2.27 I am facing the issue.
> 
> I kept the binutils 2.25.1 as default and just changed glibc from 2.31 to
> 2.32.
> 2.31 works and 2.32 doesn't.
> 
> binutils 2.27 is released around 2016 and I hope there should me some
> modification made in the glibc from 2.31 to 2.32 on top of that.

It really hard to debug such issue without a way to reproduce it so we can
isolate the issue to an specific component.

You might want to debug with either strace or gdb if the environment variables
are passed.

Meanwhile I will close it since it does not seems to be a glibc specific issue.
If you a reproducer, please reopen it.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/28499] Couldn't export variable to sub process
  2021-10-26 14:40 [Bug libc/28499] New: Couldn't export variable to sub process drvignesh1992 at gmail dot com
                   ` (2 preceding siblings ...)
  2021-10-27 14:04 ` adhemerval.zanella at linaro dot org
@ 2021-11-01 10:10 ` drvignesh1992 at gmail dot com
  2021-11-01 12:01 ` adhemerval.zanella at linaro dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: drvignesh1992 at gmail dot com @ 2021-11-01 10:10 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28499

Vignesh <drvignesh1992 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|NOTABUG                     |---
             Status|RESOLVED                    |REOPENED

--- Comment #4 from Vignesh <drvignesh1992 at gmail dot com> ---
Hi,

The below commit causes the issue

https://github.com/bminor/glibc/commit/783e641fbae0cd1ab32d278216247a6f793dd722

there should be a commit message which explains this works only from binutils
2.27.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/28499] Couldn't export variable to sub process
  2021-10-26 14:40 [Bug libc/28499] New: Couldn't export variable to sub process drvignesh1992 at gmail dot com
                   ` (3 preceding siblings ...)
  2021-11-01 10:10 ` drvignesh1992 at gmail dot com
@ 2021-11-01 12:01 ` adhemerval.zanella at linaro dot org
  2021-11-02 10:48 ` drvignesh1992 at gmail dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2021-11-01 12:01 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28499

--- Comment #5 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
(In reply to Vignesh from comment #4)
> Hi,
> 
> The below commit causes the issue
> 
> https://github.com/bminor/glibc/commit/
> 783e641fbae0cd1ab32d278216247a6f793dd722
> 
> there should be a commit message which explains this works only from
> binutils 2.27.

Are you trying to use (In reply to Vignesh from comment #4)
> Hi,
> 
> The below commit causes the issue
> 
> https://github.com/bminor/glibc/commit/
> 783e641fbae0cd1ab32d278216247a6f793dd722
> 
> there should be a commit message which explains this works only from
> binutils 2.27.

This still does not explain the issue you are seeing.  At least on x86_64
(which defines ELF_INITFINI to 1) with glibc built with gcc-10 and binutils
2.25:

x86_64-linux-gnu-binutils-2.25$ ./testrun.sh /bin/bash ./export.sh 
5
5

And I did this same experiment on armhf (wihch defines ELF_INITFINI to 0):

arm-linux-gnueabihf-binutils-2.25$ ./testrun.sh /bin/bash ./export.sh 
5
5

So I think it something else to your environment.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/28499] Couldn't export variable to sub process
  2021-10-26 14:40 [Bug libc/28499] New: Couldn't export variable to sub process drvignesh1992 at gmail dot com
                   ` (4 preceding siblings ...)
  2021-11-01 12:01 ` adhemerval.zanella at linaro dot org
@ 2021-11-02 10:48 ` drvignesh1992 at gmail dot com
  2021-11-02 12:47 ` adhemerval.zanella at linaro dot org
  2021-11-12 10:50 ` fweimer at redhat dot com
  7 siblings, 0 replies; 9+ messages in thread
From: drvignesh1992 at gmail dot com @ 2021-11-02 10:48 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28499

--- Comment #6 from Vignesh <drvignesh1992 at gmail dot com> ---
Hi,

I hope we need to pass --enable-initfini-array configure option to either
binutils or gcc

I have tried with gcc 9.3 binutils 2.25.1 and glibc 2.32 without
--enable-initfini-array configure option passed to binutils and failed

in the same build passed --enable-initfini-array to binutils and could print
5,5

the same configure option works with gcc too

Is your binutils/gcc configured with --enable-initfini-array by default, if so
it will work.

check my below build matrix
glibc 2.32 bin 2.25.1 gcc 9.3 - without config option - FAIL
glibc 2.32 bin 2.25.2 gcc 9.3 - with config option to binutils - PASS
glibc 2.32 bin 2.25.2 gcc 9.3 - with config option to gcc - PASS

glibc 2.32 bin 2.26 gcc 6.5 - without config option - FAIL
glibc 2.32 bin 2.27 gcc 6.5 - without config option - PASS

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/28499] Couldn't export variable to sub process
  2021-10-26 14:40 [Bug libc/28499] New: Couldn't export variable to sub process drvignesh1992 at gmail dot com
                   ` (5 preceding siblings ...)
  2021-11-02 10:48 ` drvignesh1992 at gmail dot com
@ 2021-11-02 12:47 ` adhemerval.zanella at linaro dot org
  2021-11-12 10:50 ` fweimer at redhat dot com
  7 siblings, 0 replies; 9+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2021-11-02 12:47 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28499

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |NOTABUG

--- Comment #7 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
The initfini support is assumed while building glibc because it has been
support for a *long* time (since glibc 2.1/binutils 2.12).  What you might be
seeing is just only recently gcc enables it as default for cross-compiling
(13a39886940331149173b25d6ebde0850668d8b9).

We do had a test for initfini support, but it was removed on glibc 2.23
(a9224562cbe9cfb0bd8d9e637a06141141f9e6e3) with the same justification is has
been supported for a long time and assumed as default.

In any case, this is not an issue with glibc.  You might want to bring this on
libc-alpha to maybe reinstate the initfini configure check as a fail-safe, but
I think the best option is to enable initfini support directly on configure.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/28499] Couldn't export variable to sub process
  2021-10-26 14:40 [Bug libc/28499] New: Couldn't export variable to sub process drvignesh1992 at gmail dot com
                   ` (6 preceding siblings ...)
  2021-11-02 12:47 ` adhemerval.zanella at linaro dot org
@ 2021-11-12 10:50 ` fweimer at redhat dot com
  7 siblings, 0 replies; 9+ messages in thread
From: fweimer at redhat dot com @ 2021-11-12 10:50 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28499

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2021-11-12 10:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 14:40 [Bug libc/28499] New: Couldn't export variable to sub process drvignesh1992 at gmail dot com
2021-10-26 20:15 ` [Bug libc/28499] " adhemerval.zanella at linaro dot org
2021-10-27 13:40 ` drvignesh1992 at gmail dot com
2021-10-27 14:04 ` adhemerval.zanella at linaro dot org
2021-11-01 10:10 ` drvignesh1992 at gmail dot com
2021-11-01 12:01 ` adhemerval.zanella at linaro dot org
2021-11-02 10:48 ` drvignesh1992 at gmail dot com
2021-11-02 12:47 ` adhemerval.zanella at linaro dot org
2021-11-12 10:50 ` fweimer at redhat dot com

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).