bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: sdiff code error


From: Paul Edwards
Subject: Re: sdiff code error
Date: Sun, 5 Nov 2006 13:04:06 +1100

> > I'm porting a lot of stuff to MVS 3.8 (IBM mainframe),
> 
> Thanks for reporting the bug.  I have installed the following patch.
> 
> Incidentally, the code in question was introduced in diffutils 2.7.2
> (published 1998-09-14) so it appears you're the first person since
> 1998 (and the first person ever) to build diffutils on a host without
> sigprocmask.

First person to report the problem, anyway.  :-)

> > It is a pure C89 environment.
> 
> In that case, you're probably still in trouble even with this fix, no?
> C89 doesn't have sigblock or sigsetmask.

Correct.  So I'm creating some dummy functions to get
around that problem, rather than changing the main code.

> > Text processing utilities should be
> > C89-compliant by default.
> 
> sdiff does more than that: it interacts with the user, who can
> interrupt it, and sdiff needs to treat the interrupts safely.

I'm not familiar with sdiff, I'm mainly trying to port diff and
diff3.  But if sdiff has an option to produce a side-by-side
difference without interaction, then that bit of functionality
should be there, C89-compliant, and by default, so that it
works on any conforming environment.

> 2006-11-04  Paul Eggert  <address@hidden>
> 
> * src/sdiff.c (sigprocmask) [! HAVE_SIGPROCMASK]: Cast 2nd arg to
> sigset_t *, since it might be a literal 0.  Problem reported by
> Paul Edwards for MVS 3.8.
> 
> Index: src/sdiff.c
> ===================================================================
> RCS file: /cvsroot/diffutils/diffutils/src/sdiff.c,v
> retrieving revision 1.43
> diff -p -u -r1.43 sdiff.c
> --- src/sdiff.c 13 Mar 2006 19:11:17 -0000 1.43
> +++ src/sdiff.c 5 Nov 2006 00:57:19 -0000
> @@ -112,7 +112,9 @@ static int const sigs[] = {
>  #  define SIG_SETMASK (! SIG_BLOCK)
>  # endif
>  # define sigprocmask(how, n, o) \
> -    ((how) == SIG_BLOCK ? *(o) = sigblock (*(n)) : sigsetmask (*(n)))
> +    ((how) == SIG_BLOCK \
> +     ? *(sigset_t *) (o) = sigblock (*(n)) \
> +     : sigsetmask (*(n)))
>  #endif
>  
>  static bool diraccess (char const *);

It still looks like it is going to write to memory address 0 to me.
What am I missing?  This resolves to *(sigset_t *)0 = something.

BFN.  Paul.





reply via email to

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