Merge lp:~vorlon/livecd-rootfs/many-loops into lp:livecd-rootfs
Proposed by
Steve Langasek
Status: | Merged |
---|---|
Approved by: | Mathieu Trudel-Lapierre |
Approved revision: | 1573 |
Merged at revision: | 1637 |
Proposed branch: | lp:~vorlon/livecd-rootfs/many-loops |
Merge into: | lp:livecd-rootfs |
Diff against target: |
25 lines (+3/-1) 2 files modified
debian/changelog (+2/-0) live-build/functions (+1/-1) |
To merge this branch: | bzr merge lp:~vorlon/livecd-rootfs/many-loops |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mathieu Trudel-Lapierre | Approve | ||
Review via email: mp+332598@code.launchpad.net |
Description of the change
Fix handling of our loop device names when our dev is >= loop10.
This is not at all extraordinary on a system which has snap packages installed.
To post a comment you must log in.
On Tue, Mar 06, 2018 at 09:55:35AM -0000, Balint Reczey wrote: functions' functions 2017-10-10 12:23:30 +0000 functions 2017-10-21 07:56:48 +0000
> > === modified file 'live-build/
> > --- live-build/
> > +++ live-build/
> > @@ -56,7 +56,7 @@
> > # Find the loop device "/dev/loop$ (echo ${loop_p1} | cut -b5)" "/dev/$ {loop_p1% p[0-9]* }"
> > loop_p1="$(echo -e ${kpartx_mapping} | head -n1 | awk '{print$3}')"
> > - loop_device=
> > + loop_device=
> This works which is a bit a bit confusing, since loop_p1%%p[0-9]* is documented in bash(1) to cover the longest matching pattern and ...%... is to cover shortest expansion.
> In dash(1) the result seems to be undefined but it works:
> ...
> If parameter is * or @, the result of the expansion is
> unspecified.
> ...
> $ dash -c 'TEST=loop43p2140 ; echo ${TEST%p[0-9]*}'
> loop43
> Maybe using sed would be more future-proof.
I think this is a question of confusing documentation, not undefined also_p6_ and_a_half, ${loop_p1%p[0-9]*} evaluates to
behavior. The actual behavior of '%p[0-9]*' is to strip off the last
occurrence of the letter p which is followed immediately by a digit, and any
characters after that. This is only relevant if there is more than one
occurrence of p[0-9] in the string. For example, if loop_p1 was
foo5p12and_
foo5p12and_also_, whereas ${loop_p1%%p[0-9]*} evaluates to foo5.