bugGNU indent - Bugs: bug #55153, indent --version returns a...

 
 

bug #55153: indent --version returns a non-zero exit code to the shell

Submitter:  Antonio Ospite <ao2>
Submitted:  Mon 03 Dec 2018 09:52:30 AM UTC
Votes: 1
 
Category:  None Severity:  3 - Normal
Item Group:  Wishlist Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 08 Dec 2018 10:17:23 AM UTC, comment #1: 

Indeed, this is an annoying problem.

First, --version is a valid option, so that invoking indent
with this option should return exit code 0, not 1, just as
other commands (e.g., gcc).

Second, calling "indent --version" and checking the exit status
is useful to distinguish between various "indent" binaries
(e.g. Sun/Oracle indent, which does not accept the --version
and returns 1 rather than 0).

Hubert Garavel <convecs>
Mon 03 Dec 2018 09:52:30 AM UTC, original submission:  

Hi,

it was brought up to my attention that GNU Indent returns a non-zero exit code to the caller even when some commands like "indent --version" or "indent --help" succeed.

This seems to be intentional[1], however it is still a surprising behavior compared to the majority of command line programs which return non-zero exit codes only when the requested operation really fails.

The current behavior can be particularly annoying when calling "indent --version" in a shell script which uses "set -e".

Looking through the history I can see that in very early versions[2], before 2.1.0, indent was doing the "right thing".

Would you consider returning 0 when the user called "indent --version" or "indent --help"? I could send a patch if needed.

If not, would you please consider documenting this peculiar behavior?

Currently the man page says:

RETURN VALUE
       Unknown

Which can be confusing.

Thank you.
   Antonio

[1] https://hg.savannah.gnu.org/hgweb/indent/file/a8d3af6b6293/src/args.c#l889
[2] https://hg.savannah.gnu.org/hgweb/indent/rev/3ce9f3929e4b#l8.803

Antonio Ospite <ao2>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by convecs (Posted a comment)
  • -email is unavailable- added by convecs (Voted in favor of this item)
  • -email is unavailable- added by ao2 (Submitted the item)
  •  

    There is 1 vote so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-12-08 convecs Carbon-Copy- Added convecs

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code