This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cannot create temp file for here document


-----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@byu.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]