Re: [PATCH] blkid: exit 2 when no specified tags match

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

 



On Thu, Jan 01, 2015 at 11:13:34PM +0100, Andreas Henriksson wrote:
> ,---- [ man blkid ]
> | RETURN CODE
> |        If the specified token was found, or if any tags were shown from (specified) devices, 0 is returned.
> |        If the specified token was not found, or no (specified) devices could be identified, an exit code of 2 is returned.
> |        For usage or other errors, an exit code of 4 is returned.
> |        If the ambivalent low-level probing result was detected, an exit code of 8 is returned.
> `----
> 
> The code doesn't seem to work like described in the (first part of the)
> second sentence. The exit code is only 2 if *no* tokens was identified,
> 0 if tokens was found but none matched the filter.

IMHO it works as expected

 $ blkid -t TYPE=ext4 &> /dev/null; echo $?
 0

 $ blkid -t TYPE=foo &> /dev/null; echo $?
 2

the return code is no affected by output tags, it means by -s <tag>

 $ blkid -t TYPE=ext4 -s DUMMY;  echo $?
 0

 $ blkid -t TYPE=ext4 -s LABEL;  echo $?
 /dev/sda2: LABEL="boot"
 0


maybe we need to improve the man page to make the description more
precise, but code works as expected. It differentiates between device
identification and output stuff.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux