Bug 239761 - Mk/Scripts/do-fetch.sh: `echo` in r507705 misses -n
Summary: Mk/Scripts/do-fetch.sh: `echo` in r507705 misses -n
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Mathieu Arnold
URL:
Keywords: needs-qa, regression
Depends on:
Blocks:
 
Reported: 2019-08-10 18:11 UTC by Ruslan Garipov
Modified: 2019-08-11 04:21 UTC (History)
2 users (show)

See Also:


Attachments
Add missed -n (406 bytes, patch)
2019-08-10 18:11 UTC, Ruslan Garipov
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ruslan Garipov 2019-08-10 18:11:28 UTC
Created attachment 206422 [details]
Add missed -n

The `echo` added in r507705[1] misses -n.  This may cause fetching for a
port's file to be spread among several lines in the output of
`make fetch-list`.  It's difficult to process such result.

Please add missing -n to the `echo`.

[1] https://svnweb.freebsd.org/ports?view=revision&revision=507705
Comment 1 Mathieu Arnold freebsd_committer 2019-08-10 20:19:58 UTC
Well, fetch-list produces a shell script, what shell are you using that has problems with the output?
Comment 2 Ruslan Garipov 2019-08-11 04:20:33 UTC
(In reply to Mathieu Arnold from comment #1)
> what shell are you using
/bin/sh

> problems with the output
I hadn't described my issue good enough, sorry, therefore you didn't
understand me.  There is no problem with the output itself.  A shell script
produced by fetch-list is correct.

The problem is that in a case described in PR 239293, a line in the
script, which download a file and which is usually "a text line" (there
are no newline characters within), becomes multiline "object".

For example:

$ cd /usr/ports/lang/rust
$ make fetch-list | cat -n
     1  mkdir -p /usr/ports/distfiles/rust && cd /usr/ports/distfiles/rust && { env /usr/bin/fetch -Fpr  -S 98707920 https://static.rust-lang.org/dist/rustc-1.36.0-src.tar.xz  || env /usr/bin/fetch -Fpr  -S 98707920 http://distcache.FreeBSD.org/ports-distfiles/rust/rustc-1.36.0-src.tar.xz  || echo "rustc-1.36.0-src.tar.xz" not fetched; }

There is no problem here: a fetching line is actually a "line".  But
here are the next lines:

     2  mkdir -p /usr/ports/distfiles/rust && cd /usr/ports/distfiles/rust && { mkdir -p "2019-05-23" &&
     3  env /usr/bin/fetch -Fpr  -S 73812596 -o 2019-05-23/rustc-1.35.0-x86_64-unknown-freebsd.tar.gz https://static.rust-lang.org/dist/2019-05-23/rustc-1.35.0-x86_64-unknown-freebsd.tar.gz  || mkdir -p "2019-05-23" &&
     4  env /usr/bin/fetch -Fpr  -S 73812596 -o 2019-05-23/rustc-1.35.0-x86_64-unknown-freebsd.tar.gz http://distcache.FreeBSD.org/local-distfiles/tobik/rust/2019-05-23/rustc-1.35.0-x86_64-unknown-freebsd.tar.gz  || mkdir -p "2019-05-23" &&
     5  env /usr/bin/fetch -Fpr  -S 73812596 -o 2019-05-23/rustc-1.35.0-x86_64-unknown-freebsd.tar.gz http://distcache.us-east.FreeBSD.org/local-distfiles/tobik/rust/2019-05-23/rustc-1.35.0-x86_64-unknown-freebsd.tar.gz  || mkdir -p "2019-05-23" &&
     6  env /usr/bin/fetch -Fpr  -S 73812596 -o 2019-05-23/rustc-1.35.0-x86_64-unknown-freebsd.tar.gz http://distcache.eu.FreeBSD.org/local-distfiles/tobik/rust/2019-05-23/rustc-1.35.0-x86_64-unknown-freebsd.tar.gz  || mkdir -p "2019-05-23" &&
     7  env /usr/bin/fetch -Fpr  -S 73812596 -o 2019-05-23/rustc-1.35.0-x86_64-unknown-freebsd.tar.gz http://distcache.us-west.FreeBSD.org/local-distfiles/tobik/rust/2019-05-23/rustc-1.35.0-x86_64-unknown-freebsd.tar.gz  || mkdir -p "2019-05-23" &&
     8  env /usr/bin/fetch -Fpr  -S 73812596 -o 2019-05-23/rustc-1.35.0-x86_64-unknown-freebsd.tar.gz http://distcache.FreeBSD.org/ports-distfiles/rust/2019-05-23/rustc-1.35.0-x86_64-unknown-freebsd.tar.gz  || echo "2019-05-23/rustc-1.35.0-x86_64-unknown-freebsd.tar.gz" not fetched; }
     {lines 9..22 are elided because they are similar to lines 2..8}

Because r507705 doesn't use `echo -n`, lines 2..7 end with
`mkdir -p "2019-05-23" &&`.  This is not an error, I just want to
collapse lines 2..8 into a single line.  Having oneline script for
fetching ``rustc-1.35.0-x86_64-unknown-freebsd.tar.gz'' (and all other
file) makes processing of the result much easy.