[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: test-update-copyright requires perl
From: |
Jim Meyering |
Subject: |
Re: test-update-copyright requires perl |
Date: |
Sat, 15 Aug 2009 17:50:09 +0200 |
Eric Blake wrote:
> According to Jim Meyering on 8/15/2009 4:53 AM:
>>> For the record, I discovered this because 'perl -ei' fails on cygwin 1.5
>>> [but
>>> works in cygwin 1.7] because of older cygwin's inability to delete in-use
>>> files:
>>
>> That should be easy to detect.
>>
>> Do you mean that perl -pi fails on cygwin 1.5?
>> For example, would this fail?
>>
>> echo a > f && perl -pi -e s/a/b/ f
>
> It's weirder than that:
>
> $ echo 1 > f
> $ perl -pi -e 's/1/2/' f
> $ cat f
> 2
> $ cat > foo <<\EOF
> #!/usr/bin/perl -pi
> s/2/3/;
> EOF
> $ chmod +x foo
> $ ./foo f
> Can't do inplace edit on f: Permission denied.
> $ ls f*
> f.bak foo
> $ mv f.bak f
> $ perl ./foo f
> Can't do inplace edit on f: Permission denied at ./foo line 1.
> $ ls f*
> foo
> $ ./foo <<EOF
> 2
> EOF
> 3
>
> I'm not sure why some invocations work and others fail, but the point is
> that update-copyright doesn't work as-is on cygwin 1.5; and it also has
> the annoying failure path of either renaming or worse deleting the
> original file. So I'm not sure how best to add skip logic to
> test-update-copyright to avoid spurious test failures.
Well, with that, adjusting the test script
to detect and skip should be trivial.
s=$TMP-script
printf '#!/usr/bin/perl -pi\ns/a/b/\n' > $s
chmod a+x $s
echo a > $TMP-in
./$s $TMP-in ||
{
printf '%s\n' "$0: skipping this test;" \
'your system has insufficient support for Perl' 1>&2
exit 77
}
However, eventually, (for improved portability) I want to convert
update-copyright itself not to use that mechanism. I.e., to have the
usual #!/usr/bin/perl first line, without any options. That's also in
line with the goal of adding --help and --version options.
One advantage of converting is that we'd get better error reporting.
Currently, we have this erroneous behavior:
$ build-aux/update-copyright no-such-file && echo ok
Can't open no-such-file: No such file or directory.
ok
i.e., while it diagnoses the missing file, the failure
does not translate to a non-zero exit status.