Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 254995

Summary: net-p2p/deluge - /etc/init.d/deluged finds the incorrect home directory when similar usernames exist
Product: Gentoo Linux Reporter: Matt Farmer <matt>
Component: Current packagesAssignee: Raúl Porcel (RETIRED) <armin76>
Status: RESOLVED FIXED    
Severity: normal CC: net-p2p
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://dev.deluge-torrent.org/ticket/728
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: minor patch to resolve the issue.

Description Matt Farmer 2009-01-15 01:22:09 UTC
When running /etc/init.d/deluged the script can find the wrong home directory of a user if DELUGED_USER is set to a username that also appears inside of another username on the system.

Example:

$ DELUGED_USER=my_user:my_user
$ getent passwd | grep $( echo "${DELUGED_USER}" | cut -d ':' -f 1 )
my_user:x:1000:1000::/home/my_user:/bin/bash
my_user_on_another_machine:x:501:100:,,,:/space:/bin/bash

In this example it will return /space, instead of /home/my_user.

Patch attached.

Also filed with Deluge at: http://dev.deluge-torrent.org/ticket/728

Reproducible: Always

Steps to Reproduce:
1.  Create a user, testuser1, with a certain home directory (/home/testuser1)
2.  Create another user, testuser12, with another home directory (/mnt/external)
3.  Set DELUGED_USER=testuser1 in /etc/conf.d/deluged
4.  Run '/etc/init.d/deluged start' and see that it has set DELUGED_USER_HOME to /mnt/external, instead of /home/testuser1

Actual Results:  
The wrong home directory is set.

Expected Results:  
The correct home directory should be set.
Comment 1 Matt Farmer 2009-01-15 01:22:34 UTC
Created attachment 178532 [details, diff]
minor patch to resolve the issue.
Comment 2 Raúl Porcel (RETIRED) gentoo-dev 2009-01-15 09:43:53 UTC
Fixed, thanks for the patch.