Colin Watson
2006-Mar-07 14:33 UTC
Bug#355708: adduser: symlinks in /etc/skel sometimes break adduser
Package: adduser Version: 3.80 Severity: normal Tags: patch The presence of symlinks in /etc/skel sometimes breaks adduser as follows: Adding user `test''... Adding new group `test'' (1000). Adding new user `test'' (1000) with group `test''. Creating home directory `/home/test''. Copying files from `/etc/skel'' symlink: Bad file descriptor Cleaning up. Removing directory `/home/test'' Removing user `test''. Removing group `test''. groupdel: group test does not exist adduser: `groupdel test` returned error code 6. Aborting. Unfortunately the only environment in which I''ve been able to reproduce this reliably is in the Ubuntu live CD installer, which isn''t something I can expect you to be able to randomly test. :-( I don''t know why it shows up in this environment but not in others. However, on looking at the code, the cause is clear: copy_to_dir() looks at $! after calling symlink() without checking symlink()''s return code first, and in the event that symlink() succeeds $! is essentially random. Here''s a patch (against 3.80 since that''s what we have in Ubuntu, but the surrounding code doesn''t seem to have changed between that and 3.85). Changelog entry: "Only check $! after calling symlink() if symlink() fails.": diff -Nru /tmp/WwKkNgpSc2/adduser-3.80/adduser /tmp/eVp2gJwz5F/adduser-3.80ubuntu1/adduser --- /tmp/WwKkNgpSc2/adduser-3.80/adduser 2005-11-18 17:15:59.000000000 +0000 +++ /tmp/eVp2gJwz5F/adduser-3.80ubuntu1/adduser 2006-03-07 11:38:39.000000000 +0000 @@ -680,8 +680,7 @@ my $error=""; $)="$newg"; $>="$newu"; - symlink("$target", "$todir/$file"); - $error="$!"; + symlink("$target", "$todir/$file") or $error="$!"; $>="$curuid"; $)="$curgid"; if( "$error" ne "" ) { Thanks, -- Colin Watson [cjwatson@debian.org]
Debian Bug Tracking System
2006-Mar-07 15:05 UTC
[Adduser-devel] Processed: Re: Bug#355708: adduser: symlinks in /etc/skel sometimes break adduser
Processing commands for control@bugs.debian.org:> tags #355708 confirmed pendingBug#355708: adduser: symlinks in /etc/skel sometimes break adduser Tags were: patch Tags added: confirmed, pending> thanksStopping processing here. Please contact me if you need assistance. Debian bug tracking system administrator (administrator, Debian Bugs database)
Marc Haber
2006-Mar-07 15:05 UTC
[Adduser-devel] Bug#355708: adduser: symlinks in /etc/skel sometimes break adduser
tags #355708 confirmed pending thanks On Tue, Mar 07, 2006 at 02:26:31PM +0000, Colin Watson wrote:> Here''s a patch (against 3.80 since that''s what we have in Ubuntu, but > the surrounding code doesn''t seem to have changed between that and > 3.85). Changelog entry: "Only check $! after calling symlink() if > symlink() fails.":Applied in svn, thanks. Greetings Marc -- ----------------------------------------------------------------------------- Marc Haber | "I don''t trust Computers. They | Mailadresse im Header Mannheim, Germany | lose things." Winona Ryder | Fon: *49 621 72739834 Nordisch by Nature | How to make an American Quilt | Fax: *49 621 72739835
Debian Bug Tracking System
2006-Apr-15 21:11 UTC
[Adduser-devel] Bug#355708: marked as done (adduser: symlinks in /etc/skel sometimes break adduser)
Your message dated Sat, 15 Apr 2006 13:47:13 -0700 with message-id <E1FUrfl-0001Gf-1N@spohr.debian.org> and subject line Bug#355708: fixed in adduser 3.86 has caused the attached Bug report to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what I am talking about this indicates a serious mail system misconfiguration somewhere. Please contact me immediately.) Debian bug tracking system administrator (administrator, Debian Bugs database) -------------- next part -------------- An embedded message was scrubbed... From: Colin Watson <cjwatson@debian.org> Subject: adduser: symlinks in /etc/skel sometimes break adduser Date: Tue, 7 Mar 2006 14:26:31 +0000 Size: 3139 Url: http://lists.alioth.debian.org/pipermail/adduser-devel/attachments/20060415/19525efd/attachment.mht -------------- next part -------------- An embedded message was scrubbed... From: Marc Haber <mh+debian-packages@zugschlus.de> Subject: Bug#355708: fixed in adduser 3.86 Date: Sat, 15 Apr 2006 13:47:13 -0700 Size: 3560 Url: http://lists.alioth.debian.org/pipermail/adduser-devel/attachments/20060415/19525efd/attachment-0001.mht