public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: [ANNOUNCEMENT] Updated: Cygwin 2.2.0-1
Date: Wed, 05 Aug 2015 10:09:00 -0000	[thread overview]
Message-ID: <20150805100952.GU17917@calimero.vinschen.de> (raw)
In-Reply-To: <3f1d63803e3546f28d65e0fc7957a204@IBTEXCHMB1.ibt.kfa-juelich.de>

[-- Attachment #1: Type: text/plain, Size: 2832 bytes --]

On Aug  5 09:19, Kiehl, Horst wrote:
> Corinna Vinschen wrote:
> 
> > The problem the fix was *supposed* to fix (but it didn't) was to disallow
> > incoming $HOME values which are non-POSIX or non-absolute paths.  These
> > $HOME values should be disregarded.
> > 
> > So the idea was:
> > 
> >   set HOME=foo		<- ignored, set HOME from passwd DB entry
> >   set HOME=C:/foo	<- same
> >   set HOME=//foo/bar	<- same
> >   set HOME=/foo/bar	<- valid, taken
> 
> The second case, IMHO, *is* an absolute path in the context of Windows:
> C:/foo
> So my assumption as a user would be that Cygwin would use this value for
> HOME in its (cygpath-) translated form: /cygdrive/c/foo
> 
> This way I could continue to use my Windows profile directory
> (%USERPROFILE%) as my Cygwin home directory (with the definition of
> HOME=%USERPROFILE% and the symbolic link /home -> cygdrive/c/Users to
> keep ssh working) as well as e.g. continue to use the Windows port of
> GNU Emacs which consults the HOME variable too.

You can do this anyway by using a matching definition in /etc/nsswitch.conf
(https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping-nsswitch), e.g.:

  db_home: %H

> In other words, if Cygwin would continue to use HOME=/cygdrive/c/foo as
> the conversion of HOME=C:/foo, this would follow the principle of least
> surprise, IMHO.
> 
> (Just thinking ... would even the third case (HOME=//foo/bar) be a valid
> scenario? Does Cygwin "technically allow" the home directory to be on
> the network? If there is a POSIX-compliant translation of //foo/bar, it
> might be a better choice than ignoring the value.)

That was a typo, sorry.  I was using slashes instead of backslashes
by habit.  //server/share is a valid POSIX path.  \\server\share isn't.

> > Right now, when started from a non-Cygwin process, Cygwin takes the
> > value of $HOME and simply calls the Win32->POSIX conversion function.
> > It does so for a long time, but is that right?  Especially if %HOME% is
> > a non-absolute == relative path, the resulting POSIX value of $HOME
> > depends on the current directory when starting Cygwin.
> 
> On my (somewhat outdated) Cygwin installation, cygpath seems to
> translate relative Windows paths to relative Cygwin paths. If I
> understand you correctly, the conversion done by cygpath is the same
> that Cygwin uses to translate the value of HOME before deciding whether
> the outcome is a valid POSIX path. Wouldn't this already detect a
> relative value of HOME as invalid?

In theory, but not as you describe above.  cygpath has a -a switch.
This functionality is used to convert $HOME.


Corinna

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

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-08-05 10:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-03 13:28 Corinna Vinschen
2015-08-03 18:43 ` Thomas Wolff
2015-08-03 19:29   ` Corinna Vinschen
2015-08-04  7:51     ` Achim Gratz
2015-08-04 18:14       ` Warren Young
2015-08-04 18:44         ` Thomas Wolff
2015-08-04 18:53         ` Achim Gratz
2015-08-05  7:54           ` Corinna Vinschen
2015-08-05  9:09             ` Thomas Wolff
2015-08-05 10:12               ` Corinna Vinschen
2015-08-06 12:03                 ` Thomas Wolff
2015-08-07  9:04                   ` Corinna Vinschen
2015-08-07 15:27                     ` cyg Simple
2015-08-07 22:19                     ` Thomas Wolff
2015-08-05  9:19             ` Kiehl, Horst
2015-08-05 10:09               ` Corinna Vinschen [this message]
2015-08-05 16:50               ` Andrey Repin
2015-08-05 16:50             ` Andrey Repin
2015-08-05 23:58               ` Nicholas Clark
2015-08-06  0:20                 ` Andrey Repin
2015-08-06  0:35                   ` Nicholas Clark
2015-08-06 11:35                     ` Andrey Repin
2015-08-07 15:16             ` cyg Simple

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150805100952.GU17917@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).