On Tue, May 11, 2010 at 10:16 PM, Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> wrote:
Hi,

[please followup to flashrom@flashrom.org]

since I didn't get any answers except "hmm..." on IRC, I hope that list
feedback will be more verbose.

In the past, flashrom served one purpose (developers writing LinuxBIOS
images or parts thereof to onboard flash), but nowadays it can handle
external programmers, graphics/network/storage cards and other hardware
as well. Given that the flashrom user base is growing rapidly especially
among less technically inclined people, we changed the flashrom command
line interface in various ways to eliminate nasty surprises.

The flashrom 0.9.2 release is impending (only one small bugfix and one
big frontend/documentation patch left), and this is why I'd like
comments about the following change:

-r and -w and -v currently take a filename argument, but that filename
can be anywhere on the command line. Examples:

flashrom -p dummy backup.rom -r
flashrom -rp dummy backup.rom
flashrom -rV backup.rom
flashrom -p dummy -r backup.rom

This flashrom behaviour is confusing and contradicts the man page which
says that -r/-w/-v are followed by a filename. Besides that, all other
options with arguments want their arguments directly after the option.

I posted a patch which will make the accepted command line syntax
conform to the man page, but I'd like to hear about any problems this
change may cause.
The patch is at http://patchwork.coreboot.org/patch/1298/ (click on
"patch" to download it in raw form) and applies cleanly against latest
flashrom from svn.

Tests of current svn flashrom with the patch applied are really
appreciated, and feedback about the interface change will be taken
seriously.

I like the suggestion.

There are lots of programs out there which presume that the first string encountered that does not have a flag assigned to it, e.g. -p or -c or whatever, is the filename to operate on. That behavior is nice when the program does not require arguments to behave in a sane manner, e.g. mplayer foo.ogg. This usage model doesn't make sense for Flashrom, so it makes sense to treat the filename as any other argument and require that it has a flag preceding it to define the behavior.

/my $0.02

--
David Hendricks (dhendrix)
Systems Software Engineer, Google Inc.