Message ID | 20230622170946.10082-2-adrian.freihofer@siemens.com |
---|---|
State | Accepted, archived |
Commit | 9ccbabc06d02addd429a21dbe15a1a42738c58d6 |
Headers | show |
Series | fixes for runqemu-gen-tapdevs | expand |
On 22 June 2023 19:01, openembedded-core@lists.openembedded.org wrote: > ip tuntap does not need the uid, it was an unused variable/parameter. > Backward compatibility should be fine. > > Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com> > --- > scripts/runqemu-ifup | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/scripts/runqemu-ifup b/scripts/runqemu-ifup > index 5dc765dee82..26714518020 100755 > --- a/scripts/runqemu-ifup > +++ b/scripts/runqemu-ifup > @@ -21,7 +21,7 @@ > # > > usage() { > - echo "sudo $(basename $0) <uid> <gid>" > + echo "sudo $(basename $0) <gid>" > } > > if [ $EUID -ne 0 ]; then > @@ -29,17 +29,20 @@ if [ $EUID -ne 0 ]; then > exit 1 > fi > > -if [ $# -ne 2 ]; then > +if [ $# -eq 2 ]; then > + echo "Warning: uid parameter is ignored. It is no longer needed." Would it be better to send this message to stderr (use `>&2`)? Regards Jörg Sommer Software Developer / Programmierer -- Navimatix GmbH Tatzendpromenade 2 07745 Jena T: 03641 - 327 99 0 F: 03641 - 526 306 M: joerg.sommer@navimatix.de www.navimatix.de Geschäftsführer: Steffen Späthe, Jan Rommeley Registergericht: Amtsgericht Jena, HRB 501480
Hello, I've already replied on another thread of this patch series, however, I have discovered this is the patch that is causing the problem. On Fri, 23 Jun 2023 at 03:31, Jörg Sommer via lists.openembedded.org <joerg.sommer=navimatix.de@lists.openembedded.org> wrote: > On 22 June 2023 19:01, openembedded-core@lists.openembedded.org wrote: > > ip tuntap does not need the uid, it was an unused variable/parameter. > > Backward compatibility should be fine. > > > > Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com> > > --- > > scripts/runqemu-ifup | 13 ++++++++----- > > 1 file changed, 8 insertions(+), 5 deletions(-) > > > > diff --git a/scripts/runqemu-ifup b/scripts/runqemu-ifup > > index 5dc765dee82..26714518020 100755 > > --- a/scripts/runqemu-ifup > > +++ b/scripts/runqemu-ifup > > @@ -21,7 +21,7 @@ > > # > > > > usage() { > > - echo "sudo $(basename $0) <uid> <gid>" > > + echo "sudo $(basename $0) <gid>" > > } > > > > if [ $EUID -ne 0 ]; then > > @@ -29,17 +29,20 @@ if [ $EUID -ne 0 ]; then > > exit 1 > > fi > > > Specifically, the following change is the one that breaks backwards compatibility, since it echoes to stdout a warning, at first sight this seems harmless, however, there is an expectation from scripts for the output to be in a certain format, e.g.: https://git.yoctoproject.org/poky/tree/scripts/runqemu#n1207 Where the output of: cmd = ('sudo', self.qemuifup, str(uid), str(gid)) try: tap = subprocess.check_output(cmd).decode('utf-8').strip() Is parsed and then used, but the "tap" variable now contains the warning from below, after this, we try to convert such variable to int() which obviously becomes an issue. Now, we can certainly remove the uid argument from the call, which would provide a workaround, but, I think we should still change this to avoid changing the expected output from a script that is used in automated calls. I'm also a bit concerned that this slipped the AB automated testing. Sending a patch to fix this soon Alejandro > -if [ $# -ne 2 ]; then > > +if [ $# -eq 2 ]; then > > + echo "Warning: uid parameter is ignored. It is no longer needed." > > Would it be better to send this message to stderr (use `>&2`)? > > Regards > > Jörg Sommer > > Software Developer / Programmierer > -- > > Navimatix GmbH > > Tatzendpromenade 2 > > 07745 Jena > > > T: 03641 - 327 99 0 > > F: 03641 - 526 306 > > M: joerg.sommer@navimatix.de > > www.navimatix.de > > > > > Geschäftsführer: Steffen Späthe, Jan Rommeley > > Registergericht: Amtsgericht Jena, HRB 501480 > > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#183312): > https://lists.openembedded.org/g/openembedded-core/message/183312 > Mute This Topic: https://lists.openembedded.org/mt/99702214/3619605 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ > alejandro@enedino.org] > -=-=-=-=-=-=-=-=-=-=-=- > >
diff --git a/scripts/runqemu-ifup b/scripts/runqemu-ifup index 5dc765dee82..26714518020 100755 --- a/scripts/runqemu-ifup +++ b/scripts/runqemu-ifup @@ -21,7 +21,7 @@ # usage() { - echo "sudo $(basename $0) <uid> <gid>" + echo "sudo $(basename $0) <gid>" } if [ $EUID -ne 0 ]; then @@ -29,17 +29,20 @@ if [ $EUID -ne 0 ]; then exit 1 fi -if [ $# -ne 2 ]; then +if [ $# -eq 2 ]; then + echo "Warning: uid parameter is ignored. It is no longer needed." + GROUP="$2" +elif [ $# -eq 1 ]; then + GROUP="$1" +else usage exit 1 fi -USERID="-u $1" -GROUP="-g $2" if taps=$(ip tuntap list 2>/dev/null); then tap_no=$(( $(echo "$taps" |cut -f 1 -d ":" | sed 's/tap//g' | sort -rn | head -n 1) + 1 )) - ip tuntap add tap$tap_no mode tap group $2 && TAP=tap$tap_no + ip tuntap add tap$tap_no mode tap group "$GROUP" && TAP=tap$tap_no fi if [ -z $TAP ]; then
ip tuntap does not need the uid, it was an unused variable/parameter. Backward compatibility should be fine. Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com> --- scripts/runqemu-ifup | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)