delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/07/15/18:28:57

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
Message-ID: <42D83890.7010908@byu.net>
Date: Fri, 15 Jul 2005 16:28:32 -0600
From: Eric Blake <ebb9 AT byu DOT net>
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
MIME-Version: 1.0
To: Barry Demchak <vendors AT tpsoft DOT com>
CC: cygwin AT cygwin DOT com
Subject: Re: cannot create temp file for here document
References: <071520051616 DOT 17192 DOT 42D7E14F0006D1840000432822007510900A050E040D0C079D0A AT comcast DOT net> <SERRANOnXuD44kLRMwA000005a0 AT SERRANO DOT CAM DOT ARTIMI DOT COM> <loom DOT 20050715T191819-539 AT post DOT gmane DOT org>
In-Reply-To: <loom.20050715T191819-539@post.gmane.org>
X-IsSubscribed: yes

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Barry Demchak on 7/15/2005 11:52 AM:
> Hi, Dave --
> 
> Pretty simple and interesting. It seems like "sort" is failing ... as if 
> there's problems with the temp directory (???).

- From the error message, it is not the sort that is failing, but this
compound statement in /etc/profile:

while read f; do
...
done <<- EOF
`/bin/find /etc/profile.d -iname '*.sh' -type f | sort`
EOF

where bash is trying to create a temporary file to collect the output of
the sort in order to pass it to the read loop.

> 
> Here's what it looks to me:
> 
> A) The TEMP and TMP environment variables are 
> both /cygdrive/c/DOCUME~1/BARRYD~1/LOCALS~1/Temp

Unix programs, if they look at the environment, tend to favor $TMPDIR and
$TMP, not $TEMP.  I could not find it in the documentation, but by reading
the source (/usr/src/bash-3.0/lib/sh/tmpfile.c, if you install the
source), bash does check $TMPDIR (sometimes), then /tmp, /var/tmp,
/usr/tmp, then . until it finds a directory that it thinks is writable.
But its check is not using the access() method, so it may be getting
confused by ACLs and selecting the wrong directory as writable.

> 
> B) The !C environment variable (which I suppose must be the same 
> as /cygdrive/c) is C:\Cygwin\bin

!C is Windows way to remember the current directory per drive letter (yes,
Windows really does have up to 27 current working directories, 26 for use
with relative drive prefixes, and the last for when there is no drive
prefix).  But cygwin does not use that variable, and only tracks a single
current working directory.

> 
> If that's all true, then the temp directory it must be trying to use would be 
> C:\Cygwin\bin\DOCUME~1/BARRYD~1/LOCALS~1/Temp ... which does not exist

Nope, since you don't define TMPDIR, bash is trying to use /tmp.  And the
location of /tmp is probably c:\cygwin\tmp, although you didn't follow the
directions to attach cygcheck output, so I can't prove that.

Please show the output of:

$ ls -l / /tmp /cygdrive/c
$ getfacl / /tmp /cygdrive/c

My guess is that there are ACLs at play, so that even though ls shows the
directory as writable, an ACL is preventing your user id from actually
creating the temp file.

> So, I'm out to lunch here ... below is the -x dump:

Actually, a combination -xv dump is nicer, because it shows commands in
context both before and after all parameters are expanded.  But what you
provided was okay.

- --
Life is short - so eat dessert first!

Eric Blake             ebb9 AT byu DOT net
volunteer cygwin bash maintainer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFC2DiQ84KuGfSFAYARAt+ZAJ9v3C59UHyCYgW3kii8B7t3XlB7/gCdGEtk
kf6lS3zuJpa5+t07ujnlnNk=
=cJZB
-----END PGP SIGNATURE-----

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

- Raw text -


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