Is the $LOGNAME env variable deprecated or broken in 11.10 Oneiric?

Asked by Chris on 2011-10-01

I have a few scripts for backup and restore type operations that use the environment variable $LOGNAME to reference the user's home directory. This works fine in previous releases (mostly 10.04 LTS) but it seems to be broken in 11.10 beta2. Is this something unexpected that should actually work, or has it been deprecated at some point and no longer works? Google searches so far have not yielded any information on this.

Chris

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu bash Edit question
Assignee:
No assignee Edit question
Solved by:
actionparsnip
Solved:
2011-10-01
Last query:
2011-10-01
Last reply:
2011-10-01

I get

andy@fileserver:~$ echo $LOGNAME
andy
andy@fileserver:~$ whoami
andy

You can set it if you want.

Chris (fabricator4) said : #2

Is that on Oneiric beta2? The environment variable is blank:

chris@chris-oneiric:~$ echo $LOGNAME

chris@chris-oneiric:~$

It does say LOGNAME should not be relied on because it _can_ be changed, but this is either a mistake that needs to be fixed, or something that's going to break a lot of scripts written since UNIX III.

Doubly, if it's working for you in beta2 but not for me, then it appears to be a bug, so the question still remains, is it a bug, or was it deprecated while I wasn't looking? I'm tending more towards a bug.

Chris

Its in Oneiric with all the updates as of the time I replied. Feel free to log a bug if you suspect one.

Chris (fabricator4) said : #4

I think I'll have to report a bug... Seems like the wheels have fallen off it somewhere along the way. First I will make sure that everything is updated even though I did this morning, and do a clean boot etc.

Chris

Chris (fabricator4) said : #5

OK, I've dropped a bug report into Launchpad, initially against bash, but changed to core-utils which I think is more correct:
https://bugs.launchpad.net/coreutils/+bug/864109

Thanks for the help - if our two systems are acting differently, and mine is a new install with not much done to it, then there's an problem there somewhere.

Chris

Chris (fabricator4) said : #6

Thanks actionparsnip, that solved my question.