darcs

Issue 2025 darcs creates temp files in current directory

Title darcs creates temp files in current directory
Priority bug Status given-up
Milestone Resolved in
Superseder Nosy List hoijarvi, kowey
Assigned To
Topics

Created on 2010-12-23.01:03:49 by hoijarvi, last changed 2017-07-31.00:22:12 by gh.

Messages
msg13406 (view) Author: hoijarvi Date: 2010-12-23.01:03:48
To reproduce:

1) Use windows XP with non-admin rights. The point is, that non-admins
cannot create files, only folders, on C:\

2) do "darcs get http://repo" and you won't get it due to 1)

I assume, that darcs still uses current folder as temporary storage.
It's just wrong, plain wrong and will cause much more trouble. Windows
has user-specific temporary folders for security reasons.
msg13407 (view) Author: kowey Date: 2010-12-23.10:31:07
Kari: do I understand correctly that the steps are [with non-admin 
rights]

1. c:
2. cd \
3. darcs get http://repo

And that you are expecting this to succeed because darcs ought to be 
able to create the repo/ directory and write into it (but it doesn't 
have the right to create eg. C:\foo.txt).

---- everybody -----

We need to figure out if this is the same as issue1172

Note that the Darcs code has an explicit sequence of identifying the 
temp folder: _darcs/prefs/tmpdir, DARCS_TMPDIR, getTemporaryDirectory, 
_darcs/.., and only then the current directory. So what would be 
interesting is to see if the files being created are what darcs thinks 
of as temp files (using tempdirloc), or if there is some other code path 
that is creating temp files of its own.

I think issue1172 indicates there is, that there are cases where for 
efficiency reasons we create a temp file as "tempfoo" and then rename it 
to "foo" (is this for fetching files over a network).  It sounds like 
this bypasses the tempdir loc mechanism and uses the current directory 
explicitly.

So the easiest next action could take here is to attempt to reproduce 
this on Windows (pending confirmation from Kari).  If there's a way to 
reproduce the same kind of conditions (can create dirs but not files), 
that could simplify things.

Another step to take would be to study the source and identify the bit 
of code that's create these "temp" files.  I suggest disabling the 
behaviour that creates the files in the current directory, and if that 
makes the Windows fetch work, we know we have an issue1172 duplicate on 
our hands.
msg13411 (view) Author: hoijarvi Date: 2010-12-23.18:57:40
Steps 1..3 are correct. It looks like this is a haskell runtime issue,
since getTemporaryDirectory should honor windows settings, which are
TEMP=C:\DOCUME~1\hoijarvi.KKH\LOCALS~1\Temp and
TMP=C:\DOCUME~1\hoijarvi.KKH\LOCALS~1\Temp, duplicate due to past
conflicting conventions and 8.3 style filenames due to MS program
managers putting spaces to pathnames. 

At least I assume getTemporaryDirectory is from haskell, not darcs. In
that case, the haskell runtime should be fixed, or if not possible,
darcs windows version should call win32 GetTempPath(),
GetTempFilePhysicalPath() or GetTempFileName()

Anyway, creating temporary files in current directory is a really bad
idea and should be avoided is possible.
msg13414 (view) Author: kowey Date: 2010-12-24.11:46:49
getTemporaryDirectory does the right thing, and I can also confirm the 
ability to make directory but not create file

I couldn't run the reproduction steps, due to issue2026 (although I 
suppose I could build darcs, but out of time for that)...

Need somebody else to reproduce this.
msg13417 (view) Author: hoijarvi Date: 2010-12-24.16:18:45
It's strange that this is difficult to reproduce.

- make sure you can create folder on C:\
- make sure you cannot create foo.txt on C:\

The next version reproduces this on 32 and 64 bit XP.

darcs compiled on Nov 20 2010, at 15:25:22

Context:

[TAG 2.5
Reinier Lamers <tux_rocker@reinier.de>**20101024151805
 Ignore-this: 1561ce30bfb1950a440c03371e0e2f20
]

Compiled with:

HTTP-4000.0.9
array-0.3.0.1
base-4.2.0.2
bytestring-0.9.1.7
containers-0.3.0.0
directory-1.0.1.1
extensible-exceptions-0.1.1.1
filepath-1.1.0.4
hashed-storage-0.5.3
haskeline-0.6.3.2
html-1.0.1.2
mtl-1.1.0.2
network-2.2.1.7
old-time-1.0.0.5
parsec-2.1.0.1
process-1.0.1.3
random-1.0.0.2
regex-compat-0.93.1
regex-posix-0.94.4
tar-0.3.1.0
text-0.10.0.0
unix-compat-0.2
zlib-0.5.2.0
msg13419 (view) Author: kowey Date: 2010-12-24.16:26:15
On Fri, Dec 24, 2010 at 16:18:46 +0000, Kari Hoijarvi wrote:
> It's strange that this is difficult to reproduce.

No, I was not able to reproduce it in the time I available
to me because of issue2026

Sorry,


-- 
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
For a faster response, try +44 (0)1273 64 2905 or
xmpp:kowey@jabber.fr (Jabber or Google Talk only)
msg13420 (view) Author: kowey Date: 2010-12-24.16:29:05
I did reproduce the fact that you can create directories but not files, as 
I mentioned in the previous message, though.  Just need somebody with the 
time to get darcs on a Windows box to poke at the resulting inability to 
download a darcs repo.
History
Date User Action Args
2010-12-23 01:03:49hoijarvicreate
2010-12-23 10:31:09koweysetstatus: unknown -> waiting-for
assignedto: hoijarvi
messages: + msg13407
title: darcs still uses current directory as temp folder -> darcs creates temp files in current directory
2010-12-23 18:57:41hoijarvisetmessages: + msg13411
2010-12-23 18:58:25hoijarvisetassignedto: hoijarvi -> kowey
nosy: + kowey
2010-12-24 11:46:50koweysetstatus: waiting-for -> needs-reproduction
assignedto: kowey ->
messages: + msg13414
2010-12-24 16:18:46hoijarvisetmessages: + msg13417
2010-12-24 16:26:16koweysetmessages: + msg13419
2010-12-24 16:29:05koweysetmessages: + msg13420
2017-07-31 00:22:12ghsetstatus: needs-reproduction -> given-up