darcs

Issue 458 make setExecutable obey umask.

Title make setExecutable obey umask.
Priority bug Status resolved
Milestone Resolved in
Superseder Nosy List darcs-devel, dmitry.kurochkin, jaredj, juhp, kowey, markstos, thorkilnaur, tommy
Assigned To
Topics ProbablyEasy

Created on 2007-05-14.08:14:22 by trentbuck, last changed 2010-03-01.11:10:17 by kowey.

Files
File name Uploaded Type Edit Remove
add-functional-sh-test-for-issue458_.dpatch trentbuck, 2008-02-02.10:45:54 text/x-darcs-patch
unnamed trentbuck, 2008-02-02.10:45:54 text/plain
Messages
msg1694 (view) Author: twb Date: 2007-05-14.08:14:13
Using a umask of 077, darcs will still make scripts executable by all
users.  The following transcript demonstrates the problem:

$ cd `mktemp -d`
$ mkdir 1
$ cd 1
$ darcs init
$ cat >x
#!/bin/sh
true
$ darcs rec -lam x x
Recording changes in "x":

Finished recording patch 'x'
$ cd ..
$ umask 077
$ darcs get 1 2
Copying patch 1 of 1... done!
Finished getting.
$ ls -la 2
total 4
drwx------ 3 twb twb 27 2007-05-14 18:10 .
drwx------ 4 twb twb 22 2007-05-14 18:10 ..
drwx------ 7 twb twb 99 2007-05-14 18:10 _darcs
-rwx--x--x 1 twb twb 15 2007-05-14 18:10 x
msg1812 (view) Author: kowey Date: 2007-07-12.08:29:46
Seems fair to say that it should not do this.

Note to anybody implementing this, however: --set-scripts-executable is
implemented in three places (I think), so you might want to refactor or something.
msg2949 (view) Author: markstos Date: 2008-01-31.03:42:54
Trent,

Thanks for the report. Following the example shell scripts in the "tests"
directory from the darcs repo, would you be willing to turn your sequence of
example shell commands into a formal darcs automated test? It should hopefully
only take a few minutes, and would help move the bug fix process along. 

   Mark
msg2958 (view) Author: twb Date: 2008-01-31.04:41:14
On Thu, Jan 31, 2008 at 03:42:55AM -0000, Mark Stosberg wrote:
> Thanks for the report. Following the example shell scripts in the
> "tests" directory from the darcs repo, would you be willing to turn
> your sequence of example shell commands into a formal darcs
> automated test? It should hopefully only take a few minutes, and
> would help move the bug fix process along.

I'm only vaguely familiar with this process; nor do I generally work
directly with darcs' own darcs repo.  I can have a go (hopefully this
weekend) if you can point me to some documentation on creating test
cases that fit into the existing test infrastructure.
msg3052 (view) Author: markstos Date: 2008-02-02.03:04:35
Trent,

With your exceptional shell skills, you'll do fine!

 darcs get --lazy (or --partial) --verbose http://darcs.net/repos/unstable 
 cd unstable/tests

 # Check out an example test script
 less obliterate.sh

 # Now, use it as a template for your new script
 cp obliterate.sh set_scripts_executable.sh
 
 # Hack on the script...then run it and see that it fails. 

 # Add the file, record the change and "darcs send". You're done!

You might also be interested to browse tests/shell_harness, which sets up the
environment that tests will run in, but that's not required to review.
msg3054 (view) Author: twb Date: 2008-02-02.10:45:54
Sat Feb  2 20:51:22 EST 2008  Trent W. Buck <twb@cyber.com.au>
  * Add functional sh test for issue458.
Attachments
msg3058 (view) Author: markstos Date: 2008-02-02.16:05:00
I've peer reviewed this test and moved it into the "./bugs" directory, since it
is currently failing.
msg3455 (view) Author: droundy Date: 2008-02-15.20:27:33
The following patch updated the status of issue458 to be resolved in the unstable branch:

* resolved issue458: make setExecutable obey umask. 

You can view the patch details online here: 
http://darcs.net/cgi-bin/darcs.cgi/unstable/?c=annotate&p=20080215185218-72aca-a027f62d1aad6eeb49c346a04e927922f393cd5a.gz
msg10087 (view) Author: juhp Date: 2010-03-01.06:39:05
With selinux, ls outputs "-rwx------." rather than "-rwx------" making 
this test fail.

Better to use grep than diff here I think.

Is it better to reopen, create a bug, or ?

This patch works for me on fedora 12:

--- darcs-2.4/tests/issue458.sh~	2010-02-27 04:10:08.000000000 +1000
+++ darcs-2.4/tests/issue458.sh	2010-03-01 14:52:54.000000000 +1000
@@ -20,9 +20,7 @@
 darcs record --repodir repo1 -lam x x
 umask 077                       # DENY ALL access to group, all
 darcs get --set-scripts-executable repo1 repo2
-ls -l repo2/x | cut -f 1 -d\  > mode
-echo -rwx------ > desired-mode
-diff -u desired-mode mode
+ls -l repo2/x | cut -f 1 -d\  | grep -- -rwx------
 
 cd ..
 rm -rf temp
msg10089 (view) Author: kowey Date: 2010-03-01.11:09:37
Hi Jens, 

I'll just create a new ticket for this (new) issue

Yeah, I think it's generally better IMHO to open a new ticket for the
cases where we have something long dead which appears to come back as a
zombie [braaaiiins], as it may often be something completely unrelated.
History
Date User Action Args
2007-05-14 08:14:22trentbuckcreate
2007-07-12 08:29:49koweysettopic: + ProbablyEasy
nosy: droundy, tommy, beschmi, kowey, trentbuck
status: unread -> unknown
messages: + msg1812
2008-01-31 03:42:55markstossetnosy: + markstos
messages: + msg2949
2008-01-31 03:44:25markstossettopic: + IncludesExampleOrTest
nosy: + jaredj
2008-01-31 04:41:15trentbucksetnosy: droundy, tommy, beschmi, kowey, markstos, trentbuck, jaredj
messages: + msg2958
2008-02-02 03:04:37markstossetstatus: unknown -> has-patch
nosy: droundy, tommy, beschmi, kowey, markstos, trentbuck, jaredj
messages: + msg3052
assignedto: trentbuck
2008-02-02 10:45:55trentbucksetfiles: + add-functional-sh-test-for-issue458_.dpatch, unnamed
nosy: droundy, tommy, beschmi, kowey, markstos, trentbuck, jaredj
messages: + msg3054
title: --set-scripts-executable ignores umask -> functional test patch bundle
2008-02-02 16:05:03markstossetnosy: droundy, tommy, beschmi, kowey, markstos, trentbuck, jaredj
assignedto: trentbuck ->
messages: + msg3058
title: functional test patch bundle -> --set-scripts-executable ignores umask
2008-02-15 20:27:35droundysetstatus: has-patch -> resolved-in-unstable
nosy: + darcs-bugs
messages: + msg3455
title: --set-scripts-executable ignores umask -> make setExecutable obey umask.
2008-05-14 18:29:06koweysetstatus: resolved-in-unstable -> resolved
nosy: + darcs-bugs, dagit, - darcs-bugs
2009-08-06 17:50:26adminsetnosy: + jast, Serware, dmitry.kurochkin, darcs-devel, zooko, mornfall, simon, thorkilnaur, - droundy, trentbuck, jaredj, darcs-bugs
2009-08-06 20:53:34adminsetnosy: - beschmi
2009-08-10 22:04:13adminsetnosy: + darcs-bugs, trentbuck, jaredj, - darcs-devel, zooko, jast, Serware, mornfall
2009-08-11 00:00:34adminsetnosy: - dagit
2009-08-25 18:01:46adminsetnosy: + darcs-devel, - simon
2009-08-27 13:59:14adminsetnosy: tommy, kowey, markstos, darcs-devel, trentbuck, thorkilnaur, jaredj, darcs-bugs, dmitry.kurochkin
2010-03-01 06:39:11juhpsettopic: - IncludesExampleOrTest
nosy: + darcs-bugs, juhp, - trentbuck, darcs-bugs
status: resolved -> unknown
messages: + msg10087
2010-03-01 11:07:04koweysetnosy: - darcs-bugs
2010-03-01 11:09:40koweysetmessages: + msg10089
2010-03-01 11:10:17koweysetstatus: unknown -> resolved