delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/04/05/06:19:44

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Thu, 5 Apr 2012 12:18:59 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: [ANNOUNCEMENT] Updated: Cygwin 1.7.12
Message-ID: <20120405101859.GM13898@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <announce DOT 20120403143701 DOT GA19014 AT calimero DOT vinschen DOT de> <87y5qbz5ye DOT fsf AT Rainer DOT invalid>
MIME-Version: 1.0
In-Reply-To: <87y5qbz5ye.fsf@Rainer.invalid>
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Apr  4 20:51, Achim Gratz wrote:
> Corinna Vinschen writes:
> >
> > I just released 1.7.12.  This is mainly a bugfix release, but a couple
> > of bigger changes were required under the hood to fix some of the bugs.
> >
> 
> I'm not really sure if that happens because of the changes in 1.7.12 or
> if I just never saw it before:

It's long-standing behaviour, already since 1.5 (maybe even 1.3) days.

> Using ~-expansion in the shell gives me the eight users that mkpasswd
> has created plus an additional "user" with ???????? as its name and the
> home directory set to /mnt/userdata, which gets me a funny prompt when

The weird home dir could be a bug in Cygwin.  I can't reproduce it,
but I could think of a reason.  Do you have a directory called
/mnt/userdata or an account called userdata in /etc/passwd?  Anyway,
I applied a patch which should result in:

  $ cd ~\?\?\?\?\?\?\?\?
  : No such file or directory.

> doing a cd into that directory.  Is there a way to drop such users from
> the expansion?

Not if we don't change Cygwin, but there's a workaround, more later.

As you know, Cygwin has to map between Windows SID and POSIX uid/gid
when mapping user accounts.  That's what /etc/passwd and /etc/group are
for.  If a file belongs to a user for which there's no entry in
/etc/passwd (same for group -> /etc/group), then the uid is set to -1.
ls then prints somthing like this:

  $ ls -l /cygdrive/c/pagefile.sys
  -rw-r-----  1 4294967295 4294967295 1073741824 Mar 24 17:40 pagefile.sys
the 

At one point, way back when, somebody thought it is a good idea if ls
doesn't print the uid/gid 4294967295, but something more meaningful.
Since these times, Cygwin always adds an entry

  ????????:*:-1:-1:

at the end of the internal copy of /etc/passwd (analog for /etc/group).

If there's a consensus that we don't need this anymore and printing
the uid/gid 4294967295 is sufficient, I'm happy to remove this entries
from the passwd and group list.

Workaround:  Add an entry with uid/gid -1 to /etc/passwd and /etc/group
to override the ???????? entry:

  $ echo "dummy::-1:-1:::" >> /etc/passwd
  $ echo "dummy::-1:" >> /etc/group
  $ ls -l /cygdrive/c/pagefile.sys
  -rw-r-----  1 dummy dummy 1073741824 Mar 24 17:40 pagefile.sys
  $ cd ~<TAB>
  Administrator  cyg_server     krbtgt         sshd_server
  Administrators dummy          LocalService   SYSTEM
  corinna        Guest          sshd

Alternatively you can use an already existing user name:

  $ echo "corinna::-1:-1:::" >> /etc/passwd
  $ cd ~<TAB>
  Administrator  cyg_server     LocalService   SYSTEM
  Administrators Guest          sshd
  corinna        krbtgt         sshd_server

However, that's kind of misleading in ls -l:

  $ ls -l /cygdrive/c/pagefile.sys
  -rw-r-----  1 corinna dummy 1073741824 Mar 24 17:40 pagefile.sys

The pagefile is certainly not owened by my own user account. 


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019