* overriding STRTOXX_EXIT_CODE does not work
@ 2017-06-21 16:56 Ruediger Meier
2017-06-21 22:06 ` Karel Zak
0 siblings, 1 reply; 3+ messages in thread
From: Ruediger Meier @ 2017-06-21 16:56 UTC (permalink / raw)
To: util-linux
Hi,
I found a little annoying issue. The trick to re-define
STRTOXX_EXIT_CODE (see a99c913091c, 2012-03-30) can't work.
When compiling strutils.c it will always use the default from
strutils.h
STRTOXX_EXIT_CODE is used only at 3 places:
disk-utils/fsck.c:#define STRTOXX_EXIT_CODE FSCK_EX_USAGE
misc-utils/blkid.c:#define STRTOXX_EXIT_CODE BLKID_EXIT_OTHER
sys-utils/tunelp.c:#define STRTOXX_EXIT_CODE 3
But there are more candidates where the return codes are broken
since strutils.h was introduced, for example here f150ac37.
$ grep -l "strutils.h" `git grep -l "FINDFS_\|MNT_EX\|MKFS_EX\|FSCK_EX" -- "*.c"`
disk-utils/fsck.c
disk-utils/fsck.cramfs.c
disk-utils/fsck.minix.c
disk-utils/mkfs.cramfs.c
disk-utils/mkfs.minix.c
libmount/src/context_mount.c
libmount/src/context_umount.c
sys-utils/fstrim.c
sys-utils/mount.c
Should we make STRTOXX_EXIT_CODE usable by moving strutils.c to
strutils.h, like optutils.h? Or any other ideas?
cu,
Rudi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: overriding STRTOXX_EXIT_CODE does not work
2017-06-21 16:56 overriding STRTOXX_EXIT_CODE does not work Ruediger Meier
@ 2017-06-21 22:06 ` Karel Zak
2017-06-22 2:19 ` Ruediger Meier
0 siblings, 1 reply; 3+ messages in thread
From: Karel Zak @ 2017-06-21 22:06 UTC (permalink / raw)
To: Ruediger Meier; +Cc: util-linux
On Wed, Jun 21, 2017 at 06:56:05PM +0200, Ruediger Meier wrote:
> Hi,
>
> I found a little annoying issue. The trick to re-define
> STRTOXX_EXIT_CODE (see a99c913091c, 2012-03-30) can't work.
> When compiling strutils.c it will always use the default from
> strutils.h
>
>
> STRTOXX_EXIT_CODE is used only at 3 places:
>
> disk-utils/fsck.c:#define STRTOXX_EXIT_CODE FSCK_EX_USAGE
> misc-utils/blkid.c:#define STRTOXX_EXIT_CODE BLKID_EXIT_OTHER
> sys-utils/tunelp.c:#define STRTOXX_EXIT_CODE 3
>
>
> But there are more candidates where the return codes are broken
> since strutils.h was introduced, for example here f150ac37.
>
> $ grep -l "strutils.h" `git grep -l "FINDFS_\|MNT_EX\|MKFS_EX\|FSCK_EX" -- "*.c"`
> disk-utils/fsck.c
> disk-utils/fsck.cramfs.c
> disk-utils/fsck.minix.c
> disk-utils/mkfs.cramfs.c
> disk-utils/mkfs.minix.c
> libmount/src/context_mount.c
> libmount/src/context_umount.c
> sys-utils/fstrim.c
> sys-utils/mount.c
>
>
> Should we make STRTOXX_EXIT_CODE usable by moving strutils.c to
> strutils.h, like optutils.h? Or any other ideas?
I don't think use static inline for everything is the right way, maybe
we can introduce
static int _strutils_exitcode;
void strutils_set_exitcode(int ex) {
_strutils_exitcode = ex;
}
function and call the function from main() for utils where it matter.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: overriding STRTOXX_EXIT_CODE does not work
2017-06-21 22:06 ` Karel Zak
@ 2017-06-22 2:19 ` Ruediger Meier
0 siblings, 0 replies; 3+ messages in thread
From: Ruediger Meier @ 2017-06-22 2:19 UTC (permalink / raw)
To: Karel Zak; +Cc: util-linux
On Thursday 22 June 2017, Karel Zak wrote:
> On Wed, Jun 21, 2017 at 06:56:05PM +0200, Ruediger Meier wrote:
> > Hi,
> >
> > I found a little annoying issue. The trick to re-define
> > STRTOXX_EXIT_CODE (see a99c913091c, 2012-03-30) can't work.
> > When compiling strutils.c it will always use the default from
> > strutils.h
> >
> >
> > STRTOXX_EXIT_CODE is used only at 3 places:
> >
> > disk-utils/fsck.c:#define STRTOXX_EXIT_CODE FSCK_EX_USAGE
> > misc-utils/blkid.c:#define STRTOXX_EXIT_CODE BLKID_EXIT_OTHER
> > sys-utils/tunelp.c:#define STRTOXX_EXIT_CODE 3
> >
> >
> > But there are more candidates where the return codes are broken
> > since strutils.h was introduced, for example here f150ac37.
> >
> > $ grep -l "strutils.h" `git grep -l
> > "FINDFS_\|MNT_EX\|MKFS_EX\|FSCK_EX" -- "*.c"` disk-utils/fsck.c
> > disk-utils/fsck.cramfs.c
> > disk-utils/fsck.minix.c
> > disk-utils/mkfs.cramfs.c
> > disk-utils/mkfs.minix.c
> > libmount/src/context_mount.c
> > libmount/src/context_umount.c
> > sys-utils/fstrim.c
> > sys-utils/mount.c
> >
> >
> > Should we make STRTOXX_EXIT_CODE usable by moving strutils.c to
> > strutils.h, like optutils.h? Or any other ideas?
>
> I don't think use static inline for everything is the right way,
> maybe we can introduce
>
> static int _strutils_exitcode;
>
> void strutils_set_exitcode(int ex) {
> _strutils_exitcode = ex;
> }
>
> function and call the function from main() for utils where it matter.
Should be good enough for our use cases.
cu,
Rudi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-22 2:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-21 16:56 overriding STRTOXX_EXIT_CODE does not work Ruediger Meier
2017-06-21 22:06 ` Karel Zak
2017-06-22 2:19 ` Ruediger Meier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.