#1872 PR merged: Aviod duplicate UUID in boot menuentry when snapper is used (issue #1871)

Labels: bug, fixed / solved / done

jsmeix opened issue at 2018-07-17 14:45:

  • Type: Bug Fix

  • Impact: Normal

  • Reference to related issue (URL):
    https://github.com/rear/rear/issues/1871

  • How was this pull request tested?
    not yet tested

  • Brief description of the changes in this pull request:
    Use grep ' on / ' with explicitly specified spaces as separators instead of grep -w 'on /'
    because on SLES with btrfs and snapper the latter results two matches that result
    two same UUIDs (with newline) that end up (with newline) in the boot menuentry

jsmeix commented at 2018-07-17 14:46:

@gozora
could you please review it because you implemented that code originally via
https://github.com/rear/rear/commit/b81693f27a41482ed89da36a9af664fe808f8186

gozora commented at 2018-07-17 14:54:

Hello @jsmeix,

Actually I'd like to ask my previous me, why were the spaces not added when this code was originally written :-)

V.

jsmeix commented at 2018-07-18 07:53:

@gozora
I was surprised to learn by this issue that the actual grep -w behaviour
does not match what I naively expected it to be
but according to man grep that reads for my GNU grep 2.16

-w, --word-regexp
Select only those lines containing matches that form whole words.
The test is that the matching substring must either be at the beginning of the line,
or preceded by a non-word constituent character. Similarly, it must be either
at the end of the line or followed by a non-word constituent character.
Word-constituent characters are letters, digits, and the underscore.

grep works as documented because a dot . is a non-word constituent character
so that the dot in /.snapshots separates it into two words / and snapshots
so that foo /.snapshots bar matches grep -w '/' (and grep -w 'snapshots').


[Export of Github issue for rear/rear.]