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

Re: jigdo-file: Does not report package rejections because checksum mismatch



On Thu, 28 Dec 2017, "Thomas Schmitt" <scdbackup@gmx.net> wrote:
> Hi,
>
> first a correction of my proposal:
>
> The else-case with
>       echo "WARNING: File not found after download:" >&2
> is not good.
> It floods the log if one uses a mirror with few matching files.
> Not finding a file after the download is a normal situation.
>
> -----------------------------------------------------------------------
>
> I wrote:
>> >                            sed -e 's/^[hH][tT][tT][pP]:\/\///' \
>> >                                -e 's/^[hH][tT][tT][pP][sS]:\/\///' \
>> >                                -e 's/^[fF][tT][pP]:\/\///' \
>> >                                -e 's/^[fF][iI][lL][eE]:\/\///'`
>
> Philip Hands wrote:
>>   sed -e 's,^\(https\?\|ftp\|file\)://,,i'
>> ...
>>   "$imageTmp/${url#[[:alpha:]]*://}"
>
> Are these widely portable enough ?

the , rather than / feature is already in use in the script (except that
its using s%%%).

\( \) is already in use, and AFAIK \| has been there for as long

\? _might_ be a bit later as a feature, in which case one could add
\|https, but then again isURI() doesn't match https: anyway

The i flag is a GNU extension, so is probably not that portable, so one
could go for \(http\|HTTP\|...

For the shell, I suspect that [[:alpha:]] is an innovation from the
90's, so one could play it safe (well, except that it might break with
odd codings) with [a-zA-Z]. posh doesn't seem to know about [:alpha:]
for instance.

posh does know about the ${ # } thing, but that wasn't in Solaris SVR4
shell AFAIK.

> Mine can be justified by S.R.Bourne's "The Unix System", i guess,
> and it is coordinated with function isURI.
>
> Well, my scruples are mainly about what wget guarantees to use as
> local disk path. I understand that jigdo-file would be quite tolerant
> as long as the file is somewhere in the "$imageTmp" tree.
> Maybe i should invest a "find" run in case of missing file. The tree is small.
>
>
> I wrote:
>> > fileMD5=`$jigdoFile md5 "$localPath" 2>/dev/null | awk '{print $1}'`
>
>> The way it's done elsewhere in the script (which I happen to think is
>> pretty horrible, but that's what is already there) is using set, thus:
>>   set -- `$jigdoFile md5sum --report=quiet "$localPath"`
>
> Option "--report=quiet" instead of "2>/dev/null" is a good point.
>
> One would have to wrap the "set --" into a sub-shell, because fetchAndMerge
> already tampers with its own arguments.
> Like:
>   answer=`$jigdoFile md5sum --report=quiet "$localPath"`
>   fileMD5=`(set -- $answer ; echo "$1")`
> Now that's really ugly.

This seems preferable, and avoids new dependencies:

  `$jigdoFile md5sum --report=quiet "$localPath" | sed 's/ .*$//'`

> If direct objections emerge against "awk", i'd consider some helper
> function which echos "$1".
>
>
>> I also happen to think that using `` rather than $() is pretty horrible
>> in this day and age, but that's what's currently there throughout the
>
> Yep. Not to speak of the headless camelBack variable names.
>
> I strive to be minimally intrusive for the purpose and to be as
> conservative as in an autotools script.

Fair enough.

Cheers, Phil.
-- 
|)|  Philip Hands  [+44 (0)20 8530 9560]  HANDS.COM Ltd.
|-|  http://www.hands.com/    http://ftp.uk.debian.org/
|(|  Hugo-Klemm-Strasse 34,   21075 Hamburg,    GERMANY

Attachment: signature.asc
Description: PGP signature


Reply to: