bug-m4
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A possible bug in m4 1.4.1 with missing file supplied as program argumen


From: Mariusz Pekala
Subject: A possible bug in m4 1.4.1 with missing file supplied as program argument
Date: Mon, 13 Oct 2003 17:50:00 +0200
User-agent: KMail/1.4.3

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello.

I suppose that this may be a bug: 
If you call m4 with non-existing file as one of m4's arument, an error message 
is printed, but the program does not terminate with error.
While this may be acceptable in normal conditions, I expect that with a flag 
- --fatal-warnings such warning will also be treated as error. If someone uses 
this flag, he expects that any 'unexpected' behaviour will not pass 
unnoticed. A missing file, especially when explicitly given in invocation of 
the program should be serious problem.
To be consistent, a builtin macro include() reports an error when the file is 
not found. To ignore errors, you have to use sinclude(), thus explicitly 
informing the program that you know the file may be missing.
Command line given file names should be treated in the same manner.

Example:

address@hidden anka]$  m4 --version
GNU m4 1.4.1
address@hidden anka]$ ls asd
ls: asd: No such file or directory
address@hidden anka]$ echo $?
1
address@hidden anka]$ m4 asd
m4: asd: No such file or directory
address@hidden anka]$ echo $?
0
address@hidden anka]$ m4 --fatal-warnings asd
m4: asd: No such file or directory
address@hidden anka]$ echo $?
0

My version of m4 is the one included in RedHat 7.3, built on March 2002.
I have looked in Changelog, NEWS and TODO files in current CVS version, but I 
haven't found any note about missing argument files.
In documentation (info m4) also nothing is explained about such missing files.

My proposition is:
1.a) If no --fatal-warnings is given, react as now. Show a message on stderr 
and go on. I am not certain about this, but you may keep this behaviour to 
not break existing programs.
1.b) If --fatal-warnings is given, report an error on sdterr and immediatelly 
exit with eror status.

2) In documentation, in section 'Invoking m4' describe the behaviour in 
section about the option --fatal-warnings AND at the end of the page, where 
you write about 'remaining arguments' that are treated as input file names.

I would be happy to supply a patch, but first I would have to familiarize with 
the sources, and this would take a very lot of time... Sorry ;-(

I know that I should write about one thing in one message, but this is small 
one, and does not deserve it's own report ;-)
In documentation, in section about macros' arguments (Node: Arguments) you may 
explicitly say that $n constructs are recognized independently of quotation 
levels used. I mean: even in constructs like define(`swap',`$2 ```$1'''') 
arguments references will be recognized. Both.
You say something similiar, even give an example with two quotation levels, 
but after reading that I was still not sure. Had to check myself.
Such note in manual would save me about 60 seconds ;-)

Thank you for this highly addictive program! ;-)
Bye,
  M.P.

- -- 
"A computer programmer is someone who, when told to "Go to Hell", sees
the "Go to", rather than the destination, as harmful."

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE/ism0vkWo15WV1rkRArnHAJ9OIfkkmGf4GP90uV0nou/ldXrrvACZAS8g
Y9r+2mpBpj9jZ1lbPiBq0u8=
=LesQ
-----END PGP SIGNATURE-----






reply via email to

[Prev in Thread] Current Thread [Next in Thread]