Bug 201910 - ltrace doesn't find all getenv calls
ltrace doesn't find all getenv calls
Product: Fedora
Classification: Fedora
Component: ltrace (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Petr Machata
: 487970 (view as bug list)
Depends On:
Blocks: 202460
  Show dependency treegraph
Reported: 2006-08-09 14:42 EDT by Penelope Fudd
Modified: 2015-05-04 21:32 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-06-16 21:13:09 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Penelope Fudd 2006-08-09 14:42:07 EDT
Description of problem:

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. ltrace -fo/tmp/a psql
2. setenv PGUSER someuser
3. ltrace -fo/tmp/a psql
Actual results:
The 'getenv("PGUSER")' call is not recorded (amongst others), but other getenv
calls are.

Expected results:
Ltrace should have recorded all getenv calls.

Additional info:
This is a weird error.
Comment 1 Petr Machata 2006-08-10 06:09:34 EDT
Can you try this, please?
$ ltrace psql --help 2>&1 | grep PGUSER
Because this works for me:
getenv("PGUSER")                                 = NULL
getenv("PGUSER")                                 = NULL
Comment 2 Penelope Fudd 2006-08-11 12:17:19 EDT
# ltrace psql --help  |& grep PGUSER
getenv("PGUSER")                                 = NULL
getenv("PGUSER")                                 = NULL
# ltrace -fo/tmp/a psql --help >& /dev/null; grep PGUSER /tmp/a
25900 getenv("PGUSER")                           = NULL
25900 getenv("PGUSER")                           = NULL
# ltrace -fo/tmp/a psql; grep PGUSER /tmp/a
psql: FATAL:  password authentication failed for user "root"
# setenv PGUSER db
# setenv PGDATABASE process
# ltrace -fo/tmp/a psql
Welcome to psql 8.1.4, the PostgreSQL interactive terminal.
process=# \q
# grep PGUSER /tmp/a
# grep PGDATABASE /tmp/a

The psql process is getting the values from the environment, but ltrace isn't
seeing the corresponding getenv() calls except when the command is 'psql --help'.
Comment 3 Petr Machata 2006-08-15 12:27:53 EDT
This problem boils down to the fact that ltrace won't trace library calls done
from inside library.  The minimal testase:

[pmachata@hridell ~]$ cat lt-nl-0.c
extern int foo (int x);
extern int printf (char const* fmt, ...);
int main (void) {
  return printf ("Guru says: %d\n", foo (11));

[pmachata@hridell ~]$ cat lt-nl-1.c
extern int bar (int x);
int foo (int x) {
  return bar (x) + 1;

[pmachata@hridell ~]$ cat lt-nl-2.c
int bar (int x) {
  return x / 10 + x % 10;

[pmachata@hridell ~]$ cat lt-nl-mk
        gcc -fpic -shared lt-nl-2.c -o liblt-nl-2.so
        gcc -fpic -shared lt-nl-1.c -o liblt-nl-1.so
        gcc lt-nl-0.c -L. -llt-nl-1 -llt-nl-2 -Wl,-rpath,. -o lt-nl

[pmachata@hridell ~]$ rpm/BUILD/ltrace-0.5/ltrace ./lt-nl
__libc_start_main(0x8048480, 1, 0xbfad1334, 0x80484bc, 0x8048518 <unfinished ...>
foo(11, 0x546360, 0xbfad12a8, 0x80484d6, 0x544ff4)                             
               = 3
printf("Guru says: %d\n", 3Guru says: 3
)                                                                   = 13
+++ exited (status 13) +++

Fixing this would require invading into PLT of the interim library, and I doubt
this is possible.  It will probably turn out to be NOTABUG, but I'll see later.
Comment 4 Penelope Fudd 2006-08-21 01:52:28 EDT
Isn't it using the library in the 'psql --help' case?
Comment 5 Petr Machata 2006-12-12 09:07:33 EST
Getting around to this bug.  Answer: it traces getenv in case of --help, so I
believe psql uses getenv directly, not via a library.

I *think* it will be possible to add the functionality of tracing also library
calls done from libraries.  But it will be no small patch, so I intend to work
with upstream there.  I will leave this open to remind me, but don't hold your
Comment 6 Bug Zapper 2008-04-03 23:29:12 EDT
Fedora apologizes that these issues have not been resolved yet. We're
sorry it's taken so long for your bug to be properly triaged and acted
on. We appreciate the time you took to report this issue and want to
make sure no important bugs slip through the cracks.

If you're currently running a version of Fedora Core between 1 and 6,
please note that Fedora no longer maintains these releases. We strongly
encourage you to upgrade to a current Fedora release. In order to
refocus our efforts as a project we are flagging all of the open bugs
for releases which are no longer maintained and closing them.

If this bug is still open against Fedora Core 1 through 6, thirty days
from now, it will be closed 'WONTFIX'. If you can reporduce this bug in
the latest Fedora version, please change to the respective version. If
you are unable to do this, please add a comment to this bug requesting
the change.

Thanks for your help, and we apologize again that we haven't handled
these issues to this point.

The process we are following is outlined here:

We will be following the process here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this
doesn't happen again.

And if you'd like to join the bug triage team to help make things
better, check out http://fedoraproject.org/wiki/BugZappers
Comment 7 Penelope Fudd 2008-04-03 23:49:44 EDT
Tested and still present in Fedora 7.

Guys, you could easily have tested this in 15 seconds yourself.
Comment 8 Penelope Fudd 2008-04-03 23:51:42 EDT
The submission page said the status of this bug would change when I submitted my
comment above, but it didn't.  I am adding this comment just so I can click on
'I am providing the requested information for this bug', which was absent for
that comment.
Comment 9 Penelope Fudd 2008-04-03 23:54:56 EDT
Hmmm.. the status is still 'Needinfo'.  Bugzilla bug?
Comment 10 Penelope Fudd 2008-04-03 23:56:07 EDT
Oh, had to change version number.

Also, typo in automated comment #6 from Bug Zapper: "If you can reporduce this
bug in..."
Comment 11 Petr Machata 2008-04-04 07:38:26 EDT
This has definitely not been fixed, and frankly, I don't have time to do so.  If
anyone wishes to send patches, I'm all hands to apply and test them (but please
work on an upstream code).

I have rough idea of how should the thing work, so if anyone wants to have this
as a small project, feel free to mail me, I'll be happy to help you out.
Comment 12 Bug Zapper 2008-05-14 08:02:42 EDT
This message is a reminder that Fedora 7 is nearing the end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 7. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '7'.

Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 7's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 7 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora please change the 'version' of this bug. If you are unable to change the version, please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. If possible, it is recommended that you try the newest available Fedora distribution to see if your bug still exists.

Please read the Release Notes for the newest Fedora distribution to make sure it will meet your needs:

The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 13 Bug Zapper 2008-06-16 21:13:08 EDT
Fedora 7 changed to end-of-life (EOL) status on June 13, 2008. 
Fedora 7 is no longer maintained, which means that it will not 
receive any further security or bug fix updates. As a result we 
are closing this bug. 

If you can reproduce this bug against a currently maintained version 
of Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.
Comment 14 Petr Machata 2012-11-23 19:40:11 EST
Note that this functionality is part of ltrace 0.7.0, which has been packaged for current Rawhide.  I intend to push it to F18 at least, perhaps all the way back to F16, the update is pretty stable in my opinion, but didn't make my mind yet.
Comment 15 Petr Machata 2012-11-25 17:15:20 EST
*** Bug 487970 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.