Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 342527 - x11-misc/slim: inadvertently resolves symlink when user's home is symbolic link
Summary: x11-misc/slim: inadvertently resolves symlink when user's home is symbolic link
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: High minor (vote)
Assignee: Ian Stakenvicius (RETIRED)
URL: http://developer.berlios.de/bugs/?fun...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-24 20:43 UTC by Fabiano
Modified: 2012-02-20 15:41 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Fix bug 342527, inadvertently following of symlinks in user's home (342527-fix-symlink-homes.patch,1.14 KB, patch)
2010-10-24 20:48 UTC, Fabiano
Details | Diff
Ebuild change do include patch bugfix of bug 342527 (slim-1.3.2-r3.ebuild.patch,393 bytes, patch)
2010-10-24 20:53 UTC, Fabiano
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fabiano 2010-10-24 20:43:37 UTC
When user's home or part of it is a symbolic link, the current dir of the started session is the real directory, and not the user's defined home. This can be annoying sometimes.

I will try to explain better exemplifyng. The home of myuser is /home/myuser, defined in /etc/passwd. When I log in with myuser, I expect that the initial current dir is /home/myuser. This is what happens with every login manager that I know of, but not always with Slim. With slim, if part of the home is a symlink, than the current dir is real directory.

For example, /home is symlink in this system, that points to /mnt/raid1/home, but I don't want to set users home to /mnt/raid1/home/myuser, I want to it to be the default /home/myuser, so I created a /home symlink pointing to /mnt/raid1/home. In this case, when log in with, say, gdm, and start a terminal, I get the following:


myuser@mygentoo:~ $ pwd
/home/myuser

myuser@mygentoo:~ $ file /proc/$$/cwd
/proc/25885/cwd: symbolic link to `/mnt/raid1/home/myuser'


That is exacly what I expect, current dir is my home dir, and bash knows that and replaces it by "~".

But, on the same system, if I log in with Slim, I get the following:


myuser@mygentoo:/mnt/raid1/home/myuser $ pwd
/mnt/raid1/home/myuser

myuser@mygentoo:/mnt/raid1/home/myuser $ file /proc/$$/cwd
/proc/25885/cwd: symbolic link to `/mnt/raid1/home/myuser'

myuser@mygentoo:/mnt/raid1/home/myuser $ cd

myuser@mygentoo:~ $ pwd
/home/myuser

myuser@mygentoo:~ $ file /proc/$$/cwd
/proc/25885/cwd: symbolic link to `/mnt/raid1/home/myuser'


With Slim, the current directory of my session is not the same as my defined home, even if in reality it points to the same place, bash doesn't reconize this dir as my home, my prompt is ugly and annoying.



Reproducible: Always

Steps to Reproduce:
1. Setup a home directory for user where part os the home dir is a symlink.
2. Log in with this user.
3. Open a terminal (like xterm).
Actual Results:  
You get your default current dir as the real directory, with any symlins resolved, and not the home directory define in passwd.

Expected Results:  
To have the current dir the same as the home directory define for that user. The expected result can be verified in all other major login managers (as gdm and kdm).

I took some time to find out why this was happening. A fork of slim, before exec the session, changes de current directory using function chdir() from <unistd.h>, the resulting this is the "real" one, and looks like nothing can be done here.

I discovered that what makes bash think that the current dir is other one, is the PWD enviroment variable. To have this right, you must no change the directory but also set this var to the correct values. If you don't, this var will get the "real" dir as value and the described problem happens.

I wrote a small patch that fix this. Slim sets a lot of env vars, I just added PWD with user's home as its value and it worked. I am attaching it on this bug.
Comment 1 Fabiano 2010-10-24 20:48:10 UTC
Created attachment 251851 [details, diff]
Fix bug 342527, inadvertently following of symlinks in user's home
Comment 2 Fabiano 2010-10-24 20:53:29 UTC
Created attachment 251853 [details, diff]
Ebuild change do include patch bugfix of bug 342527
Comment 3 Ian Stakenvicius (RETIRED) gentoo-dev 2010-10-26 16:58:52 UTC
Submitting upstream...
Comment 4 Ian Stakenvicius (RETIRED) gentoo-dev 2011-08-22 14:37:09 UTC
Sorry, it looks like this bug has slipped through the cracks..  Could you double-check to see if the issue is still happening with the latest revision?  If so, I will apply the patch to the next revision.
Comment 5 Ian Stakenvicius (RETIRED) gentoo-dev 2012-02-20 15:41:06 UTC
Upstream added this patch, it will be included in the next release.