Opened 9 years ago

Last modified 16 months ago

#7682 new bug

getenv("USER") inconsistent for Terminal and Tracker

Reported by: ttcoder Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System/POSIX Version: R1/Development
Keywords: getenv $USER Cc:
Blocked By: Blocking:
Platform: All


PrefServer (used by e.g. SoundPlay 4.9.15 and probably also the 4.7.3 build that's available from bebits) depends on variable $USER for calculating the filename of the preferences file. In other words, based on that variable it will create a file with the name e.g. "pref0:user:application:x-vnd.marcone-sndplayTT". But this piece of code..

void Preference::PrepareTransfer()

... behaves differently when run in Terminal (for debugging purposes) or when run normally (from Tracker): in Tracker the getenv() call returns NULL and as a result the filename ends up having "mister X" in it, so as a user, you're led to believe your preferences have been discarded (though in fact there's just two sets maintained at once).

This behavior of getenv() is not necessarily a "bug" per se, but it's clearly something that varies from BeOS (on BeOS 5 the variable is the same in either case; don't know if it was "null" in both cases or "non-null" in both cases but it was consistent).

I've hardcoded the 'username' inside PrefServer as a workaround for myself, so no big incentive to fix this... Filing a ticket in case it's useful to others tho.

This is hrev41843 by the way.

Change History (3)

comment:1 by luroh, 6 years ago

Milestone: R1Unscheduled

Move POSIX compatibility related tickets out of R1 milestone (FutureHaiku/Features).

comment:2 by waddlesplash, 3 years ago

Has this been fixed following the launch_daemon merge?

comment:3 by ttcoder, 16 months ago

Not sure.. Also #12534 might be related (though that one deals with spawns from input_server instead of spawns from tracker/terminal ?).

Note: See TracTickets for help on using tickets.