* [PATCH] src/t_ofd_locks.c: Reset errno to zero @ 2022-08-04 6:18 Yang Xu 2022-08-05 15:00 ` Darrick J. Wong 0 siblings, 1 reply; 4+ messages in thread From: Yang Xu @ 2022-08-04 6:18 UTC (permalink / raw) To: fstests; +Cc: Yang Xu It seems I met libcap errno bug again when using libcap-2.48-4.el8.x86_64. But this time, errno is EINVAL if c program link with lcap. Lastest upstream libcap doesn't have bug and it should be backport bug. generic/478 will become not run because of this. To fix this that only exists on some distributions, reset errno to zero. Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> --- src/t_ofd_locks.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/t_ofd_locks.c b/src/t_ofd_locks.c index e3b15ddc..e77f2659 100644 --- a/src/t_ofd_locks.c +++ b/src/t_ofd_locks.c @@ -187,6 +187,8 @@ int main(int argc, char **argv) struct sembuf sop; int opt, ret, retry; + //avoid libcap errno bug + errno = 0; while((opt = getopt(argc, argv, "sgrwo:l:PRWtFd")) != -1) { switch(opt) { case 's': -- 2.27.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] src/t_ofd_locks.c: Reset errno to zero 2022-08-04 6:18 [PATCH] src/t_ofd_locks.c: Reset errno to zero Yang Xu @ 2022-08-05 15:00 ` Darrick J. Wong 2022-08-15 10:06 ` xuyang2018.jy 0 siblings, 1 reply; 4+ messages in thread From: Darrick J. Wong @ 2022-08-05 15:00 UTC (permalink / raw) To: Yang Xu; +Cc: fstests On Thu, Aug 04, 2022 at 02:18:52PM +0800, Yang Xu wrote: > It seems I met libcap errno bug again when using libcap-2.48-4.el8.x86_64. > But this time, errno is EINVAL if c program link with lcap. > Lastest upstream libcap doesn't have bug and it should be backport bug. > > generic/478 will become not run because of this. To fix this that only > exists on some distributions, reset errno to zero. > > Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> > --- > src/t_ofd_locks.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/src/t_ofd_locks.c b/src/t_ofd_locks.c > index e3b15ddc..e77f2659 100644 > --- a/src/t_ofd_locks.c > +++ b/src/t_ofd_locks.c > @@ -187,6 +187,8 @@ int main(int argc, char **argv) > struct sembuf sop; > int opt, ret, retry; > > + //avoid libcap errno bug > + errno = 0; What sets errno to EINVAL here? And what actually causes the program to exit with code 22? There aren't any library calls prior to this point, right? Or is this ... libpcap has some initcall that runs quietly in the background before main starts, so we enter main with errno==EINVAL, which then causes ... something else to break? --D > while((opt = getopt(argc, argv, "sgrwo:l:PRWtFd")) != -1) { > switch(opt) { > case 's': > -- > 2.27.0 > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] src/t_ofd_locks.c: Reset errno to zero 2022-08-05 15:00 ` Darrick J. Wong @ 2022-08-15 10:06 ` xuyang2018.jy 2022-08-15 14:30 ` Darrick J. Wong 0 siblings, 1 reply; 4+ messages in thread From: xuyang2018.jy @ 2022-08-15 10:06 UTC (permalink / raw) To: Darrick J. Wong; +Cc: fstests@vger.kernel.org on 2022/08/05 23:00, Darrick J. Wong wrote: > On Thu, Aug 04, 2022 at 02:18:52PM +0800, Yang Xu wrote: >> It seems I met libcap errno bug again when using libcap-2.48-4.el8.x86_64. >> But this time, errno is EINVAL if c program link with lcap. >> Lastest upstream libcap doesn't have bug and it should be backport bug. >> >> generic/478 will become not run because of this. To fix this that only >> exists on some distributions, reset errno to zero. >> >> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> >> --- >> src/t_ofd_locks.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/src/t_ofd_locks.c b/src/t_ofd_locks.c >> index e3b15ddc..e77f2659 100644 >> --- a/src/t_ofd_locks.c >> +++ b/src/t_ofd_locks.c >> @@ -187,6 +187,8 @@ int main(int argc, char **argv) >> struct sembuf sop; >> int opt, ret, retry; >> >> + //avoid libcap errno bug >> + errno = 0; > > What sets errno to EINVAL here? And what actually causes the program to > exit with code 22? > > There aren't any library calls prior to this point, right? Or is this > ... libpcap has some initcall that runs quietly in the background before > main starts, so we enter main with errno==EINVAL, which then causes ... > something else to break? Yes, #include <stdio.h> #include <errno.h> int main(int argc, char **argv) { printf("errno %d\n", errno); return 0; } gcc test.c -lcap -o test then run test, errno is EINVAL. But upstream libcap is ok and it should be a backport bug on libcap distribution version. Best Regards Yang Xu > > --D > >> while((opt = getopt(argc, argv, "sgrwo:l:PRWtFd")) != -1) { >> switch(opt) { >> case 's': >> -- >> 2.27.0 >> ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] src/t_ofd_locks.c: Reset errno to zero 2022-08-15 10:06 ` xuyang2018.jy @ 2022-08-15 14:30 ` Darrick J. Wong 0 siblings, 0 replies; 4+ messages in thread From: Darrick J. Wong @ 2022-08-15 14:30 UTC (permalink / raw) To: xuyang2018.jy@fujitsu.com; +Cc: fstests@vger.kernel.org On Mon, Aug 15, 2022 at 10:06:59AM +0000, xuyang2018.jy@fujitsu.com wrote: > > > on 2022/08/05 23:00, Darrick J. Wong wrote: > > On Thu, Aug 04, 2022 at 02:18:52PM +0800, Yang Xu wrote: > >> It seems I met libcap errno bug again when using libcap-2.48-4.el8.x86_64. > >> But this time, errno is EINVAL if c program link with lcap. > >> Lastest upstream libcap doesn't have bug and it should be backport bug. > >> > >> generic/478 will become not run because of this. To fix this that only > >> exists on some distributions, reset errno to zero. > >> > >> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> > >> --- > >> src/t_ofd_locks.c | 2 ++ > >> 1 file changed, 2 insertions(+) > >> > >> diff --git a/src/t_ofd_locks.c b/src/t_ofd_locks.c > >> index e3b15ddc..e77f2659 100644 > >> --- a/src/t_ofd_locks.c > >> +++ b/src/t_ofd_locks.c > >> @@ -187,6 +187,8 @@ int main(int argc, char **argv) > >> struct sembuf sop; > >> int opt, ret, retry; > >> > >> + //avoid libcap errno bug > >> + errno = 0; > > > > What sets errno to EINVAL here? And what actually causes the program to > > exit with code 22? > > > > There aren't any library calls prior to this point, right? Or is this > > ... libpcap has some initcall that runs quietly in the background before > > main starts, so we enter main with errno==EINVAL, which then causes ... > > something else to break? > Yes, > > #include <stdio.h> > #include <errno.h> > int main(int argc, char **argv) > { > printf("errno %d\n", errno); > return 0; > } > > gcc test.c -lcap -o test > > then run test, errno is EINVAL. > > But upstream libcap is ok and it should be a backport bug on libcap > distribution version. Yay for still paying for poor decisions of the 1970s in 2022... Reviewed-by: Darrick J. Wong <djwong@kernel.org> --D > > Best Regards > Yang Xu > > > > --D > > > >> while((opt = getopt(argc, argv, "sgrwo:l:PRWtFd")) != -1) { > >> switch(opt) { > >> case 's': > >> -- > >> 2.27.0 > >> ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-08-15 14:30 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-08-04 6:18 [PATCH] src/t_ofd_locks.c: Reset errno to zero Yang Xu 2022-08-05 15:00 ` Darrick J. Wong 2022-08-15 10:06 ` xuyang2018.jy 2022-08-15 14:30 ` Darrick J. Wong
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox