darcs

Issue 538 wish: trackdown --set-scripts-executable

Title wish: trackdown --set-scripts-executable
Priority bug Status resolved
Milestone Resolved in
Superseder Nosy List darcs-devel, dmitry.kurochkin, jaredj, kowey, thorkilnaur, tommy, trentbuck, tux_rocker, twb
Assigned To tux_rocker
Topics Confirmed, ProbablyEasy

Created on 2007-09-18.21:04:15 by trentbuck, last changed 2009-08-27.14:12:56 by admin.

Messages
msg2133 (view) Author: twb Date: 2007-09-18.21:04:14
Observe that my test fails because the trackdown copy of the repo
doesn't use --set-scripts-executable.

$ darcs --version
1.0.9rc1 (release candidate 1)
$ grep executable ~/.darcs/defaults
ALL set-scripts-executable
$ darcs trackdown ./transmute
Tracking down command:
./transmute
/bin/sh: ./transmute: Permission denied
Trying without the patch:
Wed Sep 19 01:27:36 EST 2007  Trent W. Buck <twb@cyber.com.au>
  * Mimic sh -x.
/bin/sh: ./transmute: Permission denied
Trying without the patch:
Mon Aug 20 06:54:36 EST 2007  Trent W. Buck <trentbuck@gmail.com>
  * Care when a child fails.
/bin/sh: ./transmute: Permission denied
Trying without the patch:
Mon Aug 20 06:52:46 EST 2007  Trent W. Buck <trentbuck@gmail.com>
  * Define FORK-AND-WAIT.
/bin/sh: ./transmute: Permission denied
Trying without the patch:
Mon Aug 20 06:49:48 EST 2007  Trent W. Buck <trentbuck@gmail.com>
  * Define WHEN, UNLESS and ASSERT.
/bin/sh: ./transmute: Permission denied
Trying without the patch:
Mon Aug 20 05:53:04 EST 2007  Trent W. Buck <trentbuck@gmail.com>
  * Implement command-line interface.
  No argument parsing yet.
Noone passed the test!
msg2139 (view) Author: droundy Date: 2007-09-21.16:54:43
This should be a straightforward bug to fix.  Thanks for the bug report!

David
msg4325 (view) Author: tux_rocker Date: 2008-04-24.18:18:13
It seems this bug is still there. I'm going in.
msg4326 (view) Author: kowey Date: 2008-04-24.18:26:11
Yay! Watch out, though.  I suspect it's not just about enabling the
flag, but figuring out how to make it chmod scripts that it undeletes
when unpulling a patch.

Plus maybe getting things nice and factored.
msg4327 (view) Author: kowey Date: 2008-04-24.18:26:19
Yay! Watch out, though.  I suspect it's not just about enabling the
flag, but figuring out how to make it chmod scripts that it undeletes
when unpulling a patch.

Plus maybe getting things nice and factored.
msg4329 (view) Author: tux_rocker Date: 2008-04-25.08:58:41
Hmmm, in src/Darcs/Repository/Pristine.lhs lines 136 and 137 we find:

-- We don't need flags for now, since we don't care about
-- SetScriptsExecutable for the pristine cache.

It seems however that the bug reporter does care, for the effect of the patch
that adds the test file is stored in the pristine cache.
msg4330 (view) Author: kowey Date: 2008-04-25.10:51:13
One thing I'm wondering about: rather than having a --set-scripts-executable
flag, how about distributing a little posthook program that walks a directory
tree and does the chmoding for you?

We could stick it in tools.darcs.net, I suppose.
msg4331 (view) Author: twb Date: 2008-04-25.11:03:50
On Fri, Apr 25, 2008 at 10:51:15AM -0000, Eric Kow wrote:
> One thing I'm wondering about: rather than having a
> --set-scripts-executable flag, how about distributing a little
> posthook program that walks a directory tree and does the chmoding
> for you?

Hell, the existing --set-scripts-executable switch as used by apply is
already a hack -- you might as well rip that out and replace it with
the aforementioned utility.

Incidentally, that was exactly the workaround I used when I reported
the bug; since I only had one executable and I knew its name, I just
passed 'chmod +x thingy' as the setup argument.
msg4333 (view) Author: kowey Date: 2008-04-25.11:05:38
>  Hell, the existing --set-scripts-executable switch as used by apply is
>  already a hack -- you might as well rip that out and replace it with
>  the aforementioned utility.

Right, that's what I meant.
msg4394 (view) Author: tux_rocker Date: 2008-04-30.09:31:34
Because it's unclear what the semantics of --set-scripts-executable for record
can and should be (and whether --set-scripts-executable is a good idea at all),
and no one has told me, I'm unassigning this bug from me.
msg4395 (view) Author: kowey Date: 2008-04-30.09:37:55
Did you mean 'what the semantics of --set-scripts-executable for /trackdown/
can and should be'?

If so, perhaps we can discuss this.  I get the impression that the expected
behaviour would be for all scripts in the temporary working dir created by
trackdown to be +x at all times.  For instance, if the trackdown decides it
needs to unapply a patch, it should ensure that any scripts created in the
process are executable.

Or is that too vague?
msg4396 (view) Author: tux_rocker Date: 2008-04-30.10:06:01
> Did you mean 'what the semantics of --set-scripts-executable for
> /trackdown/
> can and should be'?
Possibly. But the way I made it work for unhashed repositories, I enabled
--set-scripts-executable for record. That way, scripts get stored
executably in the pristine and will end up as executables in the test
working directory. This is, I presume, why the test works if you get
--set-scripts-executable.

And of course, if you want the test to work for trackdown, you also want
it to work for record.

> If so, perhaps we can discuss this.  I get the impression that the
> expected
> behaviour would be for all scripts in the temporary working dir created by
> trackdown to be +x at all times.  For instance, if the trackdown decides
> it
> needs to unapply a patch, it should ensure that any scripts created in the
> process are executable.
The only case I can see, in which a file needs to be set executable during
the trackdown, is when a patch that removes a script is unapplied. In that
case, doesn't darcs eventually call the apply function for a hunk patch
that sets the file executable if it starts with '#!' and
--set-scripts-executable is given?
msg4397 (view) Author: kowey Date: 2008-04-30.10:11:28
>  Possibly. But the way I made it work for unhashed repositories, I enabled
>  --set-scripts-executable for record. That way, scripts get stored
>  executably in the pristine and will end up as executables in the test
>  working directory. This is, I presume, why the test works if you get
>  --set-scripts-executable.

Ooh, I don't think it would be very nice to change /anything/ about
pristine. Having --set-scripts-executable affect the test-working
directory sounds like a good thing for record and amend-record... just
not through the pristine directory.

>  And of course, if you want the test to work for trackdown, you also want
>  it to work for record.

I see.  Thanks for pointing that out.

>  The only case I can see, in which a file needs to be set executable during
>  the trackdown, is when a patch that removes a script is unapplied. In that
>  case, doesn't darcs eventually call the apply function for a hunk patch
>  that sets the file executable if it starts with '#!' and
>  --set-scripts-executable is given?

Well... we could find out by looking in the source code.  I remember
that Darcs.Patch.Apply does some detection on this.  Another way to
find out is to write a test :-)
msg4401 (view) Author: tux_rocker Date: 2008-04-30.11:09:50
Op 30-apr-2008, om 12:11 heeft Eric Kow het volgende geschreven:
> Ooh, I don't think it would be very nice to change /anything/ about
> pristine. Having --set-scripts-executable affect the test-working
> directory sounds like a good thing for record and amend-record... just
> not through the pristine directory.
OK, but executable files end up in the pristine already, and I construed that as
a feature, not a bug.
msg5190 (view) Author: twb Date: 2008-07-05.12:23:12
| Mon Jun  2 21:21:55 EST 2008  David Roundy <droundy@darcs.net>
|   * skip issue538.sh on windows, since I don't know how to run tests
|   since ./test.sh isn't accepted on windows.
|     hunk ./tests/issue538.sh 7
|     +if echo $OS | grep -i windows; then
|     +    echo I do not know how to run a test program under windows
|     +    exit 0
|     +fi
|     +

Since you already seem to be using unix commands (grep), perhaps you
could use stat(1) or find(1), both of which can examine the
executability (i.e. mode, on Unix) of files, e.g.

$ touch x y
$ chmod +x x
$ stat -c %a\ %A\ %n x y
755 -rwxr-xr-x x
644 -rw-r--r-- y
$ find -executable -type f
./x
$
msg5192 (view) Author: twb Date: 2008-07-05.12:42:55
This doesn't appear to be fixed:

$ darcs trackdown --set-scripts-executable /bin/true

darcs failed:  unrecognized option `--set-scripts-executable'
msg5194 (view) Author: twb Date: 2008-07-05.12:45:33
Regarding my previous message; that test obviously fails in 2.0.0,
because implementation took place AFTER 2.0.0 (but before the 2.0.2
release).
History
Date User Action Args
2007-09-18 21:04:16trentbuckcreate
2007-09-21 16:54:43droundysettopic: + ProbablyEasy
status: unread -> unknown
messages: + msg2139
2008-01-27 04:31:32markstossettopic: + Confirmed
nosy: + jaredj
2008-01-28 17:38:09markstoslinkissue626 superseder
2008-02-16 16:29:25markstossetstatus: unknown -> has-patch
nosy: droundy, tommy, beschmi, kowey, trentbuck, jaredj
2008-04-24 18:18:15tux_rockersetnosy: + tux_rocker
messages: + msg4325
assignedto: tux_rocker
2008-04-24 18:26:12koweysetnosy: droundy, tommy, beschmi, kowey, trentbuck, jaredj, tux_rocker
messages: + msg4326
2008-04-24 18:26:20koweysetnosy: droundy, tommy, beschmi, kowey, trentbuck, jaredj, tux_rocker
messages: + msg4327
2008-04-25 08:58:43tux_rockersetnosy: droundy, tommy, beschmi, kowey, trentbuck, jaredj, tux_rocker
messages: + msg4329
2008-04-25 10:51:14koweysetnosy: droundy, tommy, beschmi, kowey, trentbuck, jaredj, tux_rocker
messages: + msg4330
2008-04-25 11:03:53twbsetnosy: + twb
messages: + msg4331
2008-04-25 11:05:40koweysetnosy: droundy, tommy, beschmi, kowey, trentbuck, twb, jaredj, tux_rocker
messages: + msg4333
2008-04-30 09:31:35tux_rockersetnosy: + dagit
messages: + msg4394
assignedto: tux_rocker -> (no value)
2008-04-30 09:31:48tux_rockersetstatus: has-patch -> unknown
nosy: droundy, tommy, beschmi, kowey, dagit, trentbuck, twb, jaredj, tux_rocker
2008-04-30 09:37:56koweysetnosy: droundy, tommy, beschmi, kowey, dagit, trentbuck, twb, jaredj, tux_rocker
messages: + msg4395
2008-04-30 10:06:03tux_rockersetnosy: droundy, tommy, beschmi, kowey, dagit, trentbuck, twb, jaredj, tux_rocker
messages: + msg4396
2008-04-30 10:11:29koweysetnosy: droundy, tommy, beschmi, kowey, dagit, trentbuck, twb, jaredj, tux_rocker
messages: + msg4397
2008-04-30 10:25:33tux_rockersetnosy: droundy, tommy, beschmi, kowey, dagit, trentbuck, twb, jaredj, tux_rocker
messages: + msg4399
2008-04-30 11:06:48tux_rockersetnosy: droundy, tommy, beschmi, kowey, dagit, trentbuck, twb, jaredj, tux_rocker
messages: - msg4399
2008-04-30 11:09:54tux_rockersetnosy: droundy, tommy, beschmi, kowey, dagit, trentbuck, twb, jaredj, tux_rocker
messages: + msg4401
2008-05-01 18:48:52tux_rockersetstatus: unknown -> has-patch
nosy: droundy, tommy, beschmi, kowey, dagit, trentbuck, twb, jaredj, tux_rocker
assignedto: tux_rocker
2008-05-02 22:34:43tux_rockersetstatus: has-patch -> resolved
nosy: droundy, tommy, beschmi, kowey, dagit, trentbuck, twb, jaredj, tux_rocker
2008-07-05 12:23:17twbsetstatus: resolved -> unknown
nosy: droundy, tommy, beschmi, kowey, dagit, trentbuck, twb, jaredj, tux_rocker
messages: + msg5190
title: RFE trackdown --set-scripts-executable -> ./foo.sh doesn't work on Windows
2008-07-05 12:42:59twbsetnosy: droundy, tommy, beschmi, kowey, dagit, trentbuck, twb, jaredj, tux_rocker
messages: + msg5192
title: ./foo.sh doesn't work on Windows -> not really resolved?
2008-07-05 12:45:36twbsetnosy: droundy, tommy, beschmi, kowey, dagit, trentbuck, twb, jaredj, tux_rocker
messages: + msg5194
title: not really resolved? -> oops, fixed in 2.0.2 but not in 2.0.0
2008-07-24 10:44:48koweysetstatus: unknown -> resolved
nosy: droundy, tommy, beschmi, kowey, dagit, trentbuck, twb, jaredj, tux_rocker
2008-10-19 08:08:45twbsetnosy: + dmitry.kurochkin, simon, thorkilnaur
title: oops, fixed in 2.0.2 but not in 2.0.0 -> wish: trackdown --set-scripts-executable
2009-08-06 17:48:10adminsetnosy: + markstos, jast, Serware, darcs-devel, zooko, mornfall, - droundy, trentbuck, twb, jaredj, tux_rocker
2009-08-06 20:43:57adminsetnosy: - beschmi
2009-08-10 22:08:32adminsetnosy: + tux_rocker, twb, trentbuck, jaredj, - markstos, darcs-devel, zooko, jast, Serware, mornfall
2009-08-11 00:02:25adminsetnosy: - dagit
2009-08-25 17:31:24adminsetnosy: + darcs-devel, - simon
2009-08-27 14:12:56adminsetnosy: tommy, kowey, darcs-devel, trentbuck, twb, thorkilnaur, jaredj, tux_rocker, dmitry.kurochkin