Bug 3121

Summary: busybox fbset - different command line behavior: silently consumes unsupported switches and alikes
Product: Busybox Reporter: Alexander Stohr <alexander.stohr>
Component: Standard ComplianceAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: alexander.stohr, busybox-cvs
Priority: P5    
Version: 1.17.x   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:

Description Alexander Stohr 2011-01-21 17:14:13 UTC
see below for a solution suggestion... not sure if it will work fine in all cases. not sure if it will conform with all concepts of busybox.

problem:

~/busybox-1.18.2> ./busybox fbset -h
fbset: unknown video mode '-h'

~/busybox-1.18.2> ./busybox fbset -rgba dumb

~/busybox-1.18.2> ./busybox
BusyBox v1.18.2 (2011-01-21 17:57:07 CET) multi-call binary.
Copyright (C) 1998-2009 Erik Andersen, Rob Landley, Denys Vlasenko
and others. Licensed under GPLv2.
[...]

reference:

~/busybox-1.18.2> /sbin/fbset -rgba dumb
Bad RGBA syntax, rL/rO,gL/gO,bL/bO,tL/tO or rL,gL,bL,tL

~/busybox-1.18.2> /sbin/fbset -h
Linux Frame Buffer Device Configuration Version 2.1 (23/06/1999)
(C) Copyright 1995-1999 by Geert Uytterhoeven


Usage: /sbin/fbset [options] [mode]

Valid options:
  General options:
    -h, --help         : display this usage information
    --test             : don't change, just test whether the mode is valid
    -s, --show         : display video mode settings
[...]


suggested solution:

--- busybox-1.18.2.orig/util-linux/fbset.c        2011-01-21 18:11:07.000000000 +0100
+++ busybox-1.18.2/util-linux/fbset.c     2011-01-21 18:11:36.000000000 +0100
@@ -441,6 +441,8 @@
                                var_set.bits_per_pixel = xatou32(argv[1]);
                                break;
 #endif
+                       default:
+                               bb_show_usage();
                        }
                        switch (g_cmdoptions[i].code) {
                        case CMD_FB:
Comment 1 Denys Vlasenko 2011-05-09 01:58:12 UTC
(In reply to comment #0)
> --- busybox-1.18.2.orig/util-linux/fbset.c        2011-01-21 18:11:07.000000000
> +0100
> +++ busybox-1.18.2/util-linux/fbset.c     2011-01-21 18:11:36.000000000 +0100
> @@ -441,6 +441,8 @@
>                                 var_set.bits_per_pixel = xatou32(argv[1]);
>                                 break;
>  #endif
> +                       default:
> +                               bb_show_usage();
>                         }
>                         switch (g_cmdoptions[i].code) {
>                         case CMD_FB:

This won't fix the bug.

Fixed in git by commit 12bc152b31420c3e3d441c87a995fe7b65dd23fe.