[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to check ? Re: RFS -- autopkgtests for dcmtk



On Wed, Sep 28, 2022 at 01:56:17PM +0200, Mathieu Malaterre wrote:
> On Wed, Sep 28, 2022 at 1:34 PM Nilesh Patra <nilesh@debian.org> wrote:
> > Since you already uploaded this package, debci ran on it.
> > Here's the link
> >
> >         https://ci.debian.net/packages/d/dcmtk/
> >
> > And here's the latest log (on amd64)
> >
> >         https://ci.debian.net/data/autopkgtest/unstable/amd64/d/dcmtk/26349262/log.gz
> 
> Great ! Thanks for the link. I am not going to make any more noise
> about this. I just find this curious that my version of md5sum does
> not behave the same as in the deb-ci env:

Nothing wrong with your md5sum, see below:-

> % cat /etc/debian_version
> bookworm/sid
> 
> gives:
> 
>  % sh -x ./debian/tests/run-unit-test
> [...]
> + [ -f dcmp2pgm.out ]
> + md5sum --check checksums
> md5sum: checksums: no properly formatted checksum lines found
> + echo FAIL
> FAIL
> + rm -rf /tmp/dcmtk-test.5wl9lz

That's because you are explicitly interpreting it with `sh` rather than shebang do
its job which sets it to bash.
I suspect that on your system, `sh` is linked to `dash` and that indeed fails as well
for me.

$ dash -x ./debian/tests/run-unit-test
[...]
+ md5sum --check checksums
md5sum: checksums: no properly formatted MD5 checksum lines found
+ echo FAIL
+ rm -rf /tmp/dcmtk-test.jJjF3b
FAIL

However if I change the permissions and run it,

$ chmod +x ./debian/tests/run-unit-test; ./debian/tests/run-unit-test
[...]
CT_small.dcm: OK
PASS

And same for:
$ bash ./debian/tests/run-unit-test
[...]
CT_small.dcm: OK
PASS

I wrote a little reasoning for it below:-

> I would need to change:
> 
> echo -e "15e7e2a11cdeabac32e1134674beda6b CT_small.dcm" >> checksums
> 
> into:
> 
> echo "15e7e2a11cdeabac32e1134674beda6b CT_small.dcm" >> checksums

Yep. That's because "echo -e" introduces bashism

As an example, with bash:

$ echo -e "Test 17"
Test 17

With dash:
$ echo -e "Test 17"
-e Test 17

Now if that script is run with sh linked to dash, there are tonnes
of "-e" infront of the filenames, I did a cat of the checksums file and here
is what I see:

-e 15e7e2a11cdeabac32e1134674beda6b  CT_small.dcm

md5sum cannot interpret the "-e" and chokes.

> ref:
> * https://salsa.debian.org/med-team/dcmtk/-/commit/61bcbf663b79ee177dee878c72d6eda9b33683ea#8c77cc51b09ef1f7b294222180bcdb53ebb70e2f_0_23
> 
> oh well...

In this case it might make sense to remove the "-e" to make the script posix compliant, since I do not
particularly see the need to enable backslash interpretation.

PS: sorry for a long email, and I suppose you already knew it anyway :)

-- 
Best,
Nilesh

Attachment: signature.asc
Description: PGP signature


Reply to: