darcs

Issue 2668 createDirectory: permission denied (Permission denied)

Title createDirectory: permission denied (Permission denied)
Priority Status unknown
Milestone Resolved in
Superseder Nosy List gpiero
Assigned To
Topics

Created on 2020-12-02.11:28:06 by gpiero, last changed 2020-12-04.07:24:53 by bf.

Files
File name Uploaded Type Edit Remove
darcs.debug gpiero, 2020-12-02.11:28:03 text/plain
Messages
msg22530 (view) Author: gpiero Date: 2020-12-02.11:28:04
I have my home dir versioned with darcs:

          Format: hashed, darcs-2
            Root: /home/gpiero
    PristineType: HashedPristine
           Cache: thisrepo:/home/gpiero, cache:/home/gpiero/.cache/darcs
      PatchIndex: enabled
  Default Remote: maometto.fdc.rm-rf.it:var/local/repos/homedir
     Num Patches: 75
       Weak Hash: e6084d42f16ae7188225fae534bd9be0fc679adf

Obviously, /home/gpiero is writable by my user, but /home isn't.

Since a while (a few months, I'd guess) I get the following error 
whenever I record a patch:

$ darcs record --debug --no-prehook --no-posthook -am foobar .
/home/gpiero-90d5dad8adb19515: createDirectory: permission denied 
(Permission denied)
Failed to record patch 'foobar'

(Full debug output attached).

$ darcs --version 
2.16.3 (+ 35 patches)

The 'permission denied' error also occurs when unrecording a patch.  
Despite the error (and the 'Failed' message in the recording case), the 
patch is correctly recorded/unrecorded, but darcs signals an error and 
the posthook commands are not run (in my case that is the real issue, as 
the posthook manages permissions and symlinks).

Thanks,
Gian Piero.
Attachments
msg22531 (view) Author: bf Date: 2020-12-03.09:13:27
I cannot reproduce this. I have added the following test script:

ben@home[2]:.../darcs/head>cat
tests/issue2668-create-directory-permission.sh
#!/usr/bin/env bash

. lib

forbidden_path=$(pwd)/forbidden
trap "chmod +w $forbidden_path" EXIT

rm -rf forbidden
mkdir forbidden
darcs init forbidden/R
chmod -w forbidden
cd forbidden/R
echo text > file
darcs record -l file -am foobar >LOG 2>&1
not grep 'permission denied' LOG
darcs unrecord -a -p foobar >LOG 2>&1
not grep 'permission denied' LOG


This test succeeds for me (screened and darcs-2.16.3).

The only explanation I can offer is that perhaps you have something
strange in your defaults; or perhaps a 'setpref test' which issues this
message (but still succeeds).
msg22532 (view) Author: gpiero Date: 2020-12-03.11:03:10
* [Thu, Dec 03, 2020 at 09:13:30AM +0000] Ben Franksen:
>I cannot reproduce this. I have added the following test script:
[...]

Found it. It's the patch-index creating its temporary file outside the 
repo: disabling it, the record succeeds.  Now the problem is that I 
cannot re-enable it anymore:

$ darcs optimize enable-patch-index 
darcs: /home/gpiero-8723add3cfa57929: createDirectory: permission denied (Permission denied)

Anyway, I think the error passing between the various steps needs some 
adjustments:

- the patch was correctly recorded, but darcs issued a 'Failed to record 
   patch' message
- a failure in the patch index update caused the post-hook to not be 
   run
   
I'm a bit unsure about the latter, but my feelings is that a failure in 
the patch-index should not cause the above.

Thanks,
Gian Piero.
msg22533 (view) Author: bf Date: 2020-12-04.05:41:42
Thanks gpiero, I can now reproduce. Will fix.
msg22534 (view) Author: bf Date: 2020-12-04.07:01:03
> - the patch was correctly recorded, but darcs issued a 'Failed to record 
>    patch' message
> - a failure in the patch index update caused the post-hook to not be 
>    run
>    
> I'm a bit unsure about the latter, but my feelings is that a failure in 
> the patch-index should not cause the above.

I agree. Updating the patch index is not essential which is why we do
after we have finalized our repo changes; so we should catch IO errors,
report them, and then succeed.
msg22538 (view) Author: bf Date: 2020-12-04.07:24:51
I have pushed fixes for both parts of this issue.
History
Date User Action Args
2020-12-02 11:28:06gpierocreate
2020-12-03 09:13:30bfsetmessages: + msg22531
2020-12-03 11:03:13gpierosetmessages: + msg22532
2020-12-04 05:41:45bfsetmessages: + msg22533
2020-12-04 07:01:06bfsetmessages: + msg22534
2020-12-04 07:24:53bfsetmessages: + msg22538