darcs

Issue 562 Tests fail if there is a space in the path

Title Tests fail if there is a space in the path
Priority bug Status resolved
Milestone Resolved in
Superseder Nosy List RichardG, darcs-devel, dmitry.kurochkin, kowey, markstos, thorkilnaur, tommy
Assigned To markstos
Topics

Created on 2007-11-13.15:05:38 by RichardG, last changed 2009-08-27.14:07:39 by admin.

Files
File name Uploaded Type Edit Remove
darcs-unstable-test.txt RichardG, 2007-11-13.15:05:30 text/plain
Messages
msg2261 (view) Author: RichardG Date: 2007-11-13.15:05:30
I checked out the latest unstable version of darcs and ran the following 
commands:
{{{
   autoconf
   ./configure
   make
   export DARCS=`pwd`/darcs
   make test
}}}

Most of the tests fail if $DARCS has spaces in it.  The tests all 
succeed if $DARCS has no spaces.

Mac OS X 10.4.10 (Intel)
GHC 6.6.1
PERL 5.8.6
BASH 2.05b.0(1)-release (powerpc-apple-darwin8.0)
Attachments
msg2262 (view) Author: droundy Date: 2007-11-13.15:36:55
On Tue, Nov 13, 2007 at 03:05:38PM -0000, Richard Giraud wrote:
> I checked out the latest unstable version of darcs and ran the following 
> commands:
> {{{
>    autoconf
>    ./configure
>    make
>    export DARCS=`pwd`/darcs
>    make test
> }}}
> 
> Most of the tests fail if $DARCS has spaces in it.  The tests all 
> succeed if $DARCS has no spaces.

Hmmm.  I suppose the answer is to escape $DARCS somehow.  Any ideas? We use
this DARCS=`pwd`/darcs (actually DARCS=`pwd`/../darcs) a lot in the tests,
so it'd be good to figure this out.  Maybe we should just instead do
something like:

if $DARCS
PATH=$PATH:`dirname $DARCS`
DARCS=`basename $DARCS`
else
PATH=$PATH:`pwd`/..
DARCS=darcs
fi

Does that sound robust, or more robust? We'd still have trouble if the
darcs binary itself had a space in it, but that's just a user asking for
trouble, and we *are* talking about test scripts here, which needn't be
robust to actively hostile users (which is how I'd categorize someone who
tries renaming darcs to include a space before running the test scripts).
-- 
David Roundy
Department of Physics
Oregon State University
msg2263 (view) Author: tommy Date: 2007-11-13.18:55:31
Hm, we could maybe use:

[... the current DARCS= setup ...]
darcs () {
  "$DARCS" $@
}

darcs --some test
darcs --more tests
msg2264 (view) Author: droundy Date: 2007-11-13.20:20:34
On Tue, Nov 13, 2007 at 06:55:32PM -0000, Tommy Pettersson wrote:
> Hm, we could maybe use:
> 
> [... the current DARCS= setup ...]
> darcs () {
>   "$DARCS" $@
> }
> 
> darcs --some test
> darcs --more tests

That also sounds workable.
-- 
David Roundy
Department of Physics
Oregon State University
msg2265 (view) Author: kowey Date: 2007-11-13.21:34:09
On Tue, Nov 13, 2007 at 15:05:38 -0000, Richard Giraud wrote:
>    export DARCS=`pwd`/darcs

I wonder if some quotes would help here, something like
  export DARCS="${PWD}/darcs"

If this is the case, we could imagine adding something to the tests that
complains if it can't call darcs from $DARCS or something like that.
msg2266 (view) Author: tommy Date: 2007-11-13.22:22:29
On Tue, Nov 13, 2007 at 09:34:09PM -0000, Eric Kow wrote:
> I wonder if some quotes would help here, something like
>   export DARCS="${PWD}/darcs"

I'm afraid that won't help, and sh (in all its variations) is to
blame. It will re-parse the expanded value each time the
variable is expanded, so we'd have to write "$DARCS" instead of
$DARCS on each darcs invocation. For those who want to move on
to a more modern command scripting environment I can recommend
rc <http://rc-shell.slackmatic.org/> (or apt-get install rc).
C'mon, let's convert the whole world from sh to rc. ;-)

I think the function trick can be tweaked something like this:

if test $DARCS; then
  THEDARCS="$DARCS"
else
  THEDARCS="$PWD/../darcs"
fi
thedarcs () {
  "$THEDARCS" $@
}
$DARCS=thedarcs

Then we won't have to rewrite all the uses of $DARCS in the test
scripts, but it's kind of ugly.

By the way, the build of some of the graphics in the doc also
fails if there's a space in the path.
msg2337 (view) Author: markstos Date: 2008-01-06.04:01:39
I will start addressing this for the *.pl scripts.  We already have a "darcs()"
command in Perl, but 11 of the scripts still use $DARCS instead.
msg2338 (view) Author: markstos Date: 2008-01-06.05:00:54
Ok, I've sent a patch to darcs-devel so most Perl test scripts should be fixed
regarding this now. The patch name was: "issue526: improve Perl test suite."
msg2600 (view) Author: markstos Date: 2008-01-19.15:51:15
I'll take this one for now.
msg2628 (view) Author: markstos Date: 2008-01-21.03:15:40
I have now made updates to fix them, and tested all the ".sh" and ".pl" scripts.
My patches have been "sent" to darcs-unstable now. I'm marking this as
resolved-in-unstable now, pending the final review and application of the
patches upstream. 

Thanks for the report, RichardG!
History
Date User Action Args
2007-11-13 15:05:39RichardGcreate
2007-11-13 15:36:59droundysetstatus: unread -> unknown
messages: + msg2262
2007-11-13 18:55:33tommysetmessages: + msg2263
2007-11-13 20:20:35droundysetmessages: + msg2264
2007-11-13 21:34:11koweysetmessages: + msg2265
2007-11-13 22:22:31tommysetmessages: + msg2266
2008-01-06 04:01:41markstossetnosy: + markstos
messages: + msg2337
2008-01-06 05:00:55markstossetmessages: + msg2338
2008-01-19 15:51:16markstossetstatus: unknown -> has-patch
nosy: droundy, tommy, beschmi, kowey, markstos, RichardG
messages: + msg2600
assignedto: markstos
2008-01-21 03:15:42markstossetstatus: has-patch -> resolved-in-unstable
nosy: droundy, tommy, beschmi, kowey, markstos, RichardG
messages: + msg2628
2008-09-04 21:31:37adminsetstatus: resolved-in-unstable -> resolved
nosy: + dagit
2009-08-06 17:47:36adminsetnosy: + jast, Serware, dmitry.kurochkin, darcs-devel, zooko, mornfall, simon, thorkilnaur, - droundy, RichardG
2009-08-06 20:43:24adminsetnosy: - beschmi
2009-08-10 22:09:40adminsetnosy: + RichardG, - darcs-devel, zooko, jast, Serware, mornfall
2009-08-11 00:03:48adminsetnosy: - dagit
2009-08-25 17:59:21adminsetnosy: + darcs-devel, - simon
2009-08-27 14:07:39adminsetnosy: tommy, kowey, markstos, darcs-devel, RichardG, thorkilnaur, dmitry.kurochkin