delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2002/05/22/08:56:34

Mailing-List: contact cygwin-developers-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT cygwin DOT com>
List-Help: <mailto:cygwin-developers-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT cygwin DOT com
Delivered-To: mailing list cygwin-developers AT cygwin DOT com
Date: Wed, 22 May 2002 14:56:27 +0200
From: Corinna Vinschen <vinschen AT redhat DOT com>
To: Cygwin-Developers <cygwin-developers AT cygwin DOT com>
Subject: Re: path_conv::check() gets confused by recently opened files
Message-ID: <20020522145627.G10218@cygbert.vinschen.de>
Reply-To: cygwin-developers AT cygwin DOT com
Mail-Followup-To: Cygwin-Developers <cygwin-developers AT cygwin DOT com>
References: <20020521200309 DOT GA2392 AT tishler DOT net>
Mime-Version: 1.0
In-Reply-To: <20020521200309.GA2392@tishler.net>
User-Agent: Mutt/1.3.22.1i

On Tue, May 21, 2002 at 04:03:09PM -0400, Jason Tishler wrote:
> I stumbled across a problem with path_conv::check() when scp-ing a
> read-only file.  I can reproduce the problem with the attached simple
> test case, tchmod.cc.  For example:
> 
>     $ ls -l -d foo foo/readonly 
>     ls: foo/readonly: No such file or directory
>     drwxr-xr-x    2 jt       Domain U        0 May 21 15:13 foo
>     $ tchmod foo/readonly
>     $ ls -l -d foo foo/readonly
>     dr--r--r--    2 jt       Domain U        0 May 21 15:13 foo
>     -rw-r--r--    1 jt       Domain U        0 May 21 15:13 foo/readonly
> 
> Note that foo's permissions should not have changed and foo/readonly
> should be read-only instead of read-write.
> 
> The expected results which can be forced by supplying a second argument
> is:
> 
>     $ ls -l -d foo foo/readonly
>     ls: foo/readonly: No such file or directory
>     drwxr-xr-x    2 jt       Domain U        0 May 21 15:23 foo
>     $ tchmod foo/readonly 1
>     $ ls -l -d foo foo/readonly
>     drwxr-xr-x    2 jt       Domain U        0 May 21 15:23 foo
>     -r--r--r--    1 jt       Domain U        0 May 21 15:23 foo/readonly
> 
> Unfortunately, I haven't figured out how to teach path_conv::check()
> to deal with recently opened files.  I'm also a little leery to perturb
> this code.  Any hints or help would be greatly appreciated.

I found that path_conv::check() pinches off the tail when searching
for existing path components.  This strips the filename here from
path_copy since it doesn't exist yet.  The effect is that 
path_conv->normalized_path can't be correct when path_conv points
to a yet non-existant file.  I don't see an easy way to get the
correct normalized path without introducing an additioanl temporary
copy of the path.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin AT cygwin DOT com
Red Hat, Inc.

- Raw text -


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