[bug #58743] siggetmask should be called with no arguments.

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[bug #58743] siggetmask should be called with no arguments.

David Boyce-5
URL:
  <https://savannah.gnu.org/bugs/?58743>

                 Summary: siggetmask should be called with no arguments.
                 Project: make
            Submitted by: None
            Submitted on: Fri 10 Jul 2020 06:28:55 AM UTC
                Severity: 3 - Normal
              Item Group: Build/Install
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 4.3
        Operating System: POSIX-Based
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:

Hi,

Porting make with tcc compiler on Linux, I’ve found that siggetmask is
called with argument 0 while it accepts none (see src/jobs.c)

It is defined in <signal.h> as:
extern int siggetmask (void) __THROW __attribute_deprecated__;

But src/jobs.c calls it this way.
static void
unblock_sigs ()
{
  sigsetmask (siggetmask (0) & ~fatal_signal_mask)
}

And tcc complains (with reasons):
src/job.c:507: error: too many arguments to function

Adding –Wall –Wextra also helps gcc to complain

Please note that sig[sg]etmask functions are deprecated.

While sigsetmask seems to always be defined with no arg, man siggetmask shows
an int argument on Debian while it is removed in more recent Linux man pages
like Fedora 32.

Changing siggetmask(0) to siggetmask() lets tcc to terminate compilation with
a working make (I recompiled make with this one compiled by tcc).

Christian Jullien





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58743>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply | Threaded
Open this post in threaded view
|

[bug #58743] siggetmask should be called with no arguments.

David Boyce-5
Follow-up Comment #1, bug #58743 (project make):

Thanks, I will fix this.  The reason this doesn't show up on systems I test on
is that this code is only run if the POSIX macro is not set.

The POSIX macro will be set if both HAVE_UNISTD_H is defined AND
_POSIX_VERSION is defined (unless either ultrix of VMS are also defined).

I can't imagine why tcc on Linux causes this to not work.  I would assume
that, unless you're also using some strange libc other than GNU libc which
does not set _POSIX_VERSION, that it should be set regardless of the
compiler.

I recommend you investigate the output of config.log to find out why these
options are not set.

From makeint.h:


#ifdef  HAVE_UNISTD_H
# include <unistd.h>
/* Ultrix's unistd.h always defines _POSIX_VERSION, but you only get
   POSIX.1 behavior with 'cc -YPOSIX', which predefines POSIX itself!  */
# if defined (_POSIX_VERSION) && !defined (ultrix) && !defined (VMS)
#  define POSIX 1
# endif
#endif


Then it gets undefined again but only on very old systems.

And in src/job.c:


#ifdef POSIX
  ...
#elif defined(HAVE_SIGSETMASK)
  ...

static void
unblock_sigs ()
{
  sigsetmask (siggetmask (0) & ~fatal_signal_mask)
}
  ...
#endif



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58743>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply | Threaded
Open this post in threaded view
|

[bug #58743] siggetmask should be called with no arguments.

David Boyce-5
Follow-up Comment #2, bug #58743 (project make):

I forgot to mention it is for RPi which is arm.
It may be related to: [bug #58347] Build failure on 32-bit ARM


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58743>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply | Threaded
Open this post in threaded view
|

[bug #58743] siggetmask should be called with no arguments.

David Boyce-5
Update of bug #58743 (project make):

                  Status:                    None => Fixed                  
             Assigned to:                    None => psmith                
             Open/Closed:                    Open => Closed                
           Fixed Release:                    None => SCM                    


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58743>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply | Threaded
Open this post in threaded view
|

[bug #58743] siggetmask should be called with no arguments.

David Boyce-5
Follow-up Comment #3, bug #58743 (project make):

Now works well with tcc and you last commit.
In fact, I had to remove -C (comment) gcc option which is not supported by
tcc.

Maybe you should test if $(CC) supports -C.

I also tested on RPi 64bit which is aarch64 not arm.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58743>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply | Threaded
Open this post in threaded view
|

[bug #58743] siggetmask should be called with no arguments.

David Boyce-5
Follow-up Comment #4, bug #58743 (project make):

That flag is only used in maintenance mode, which has a number of requirements
on the system AND ALSO adds a bunch of debugging code that will unquestionably
slow down your GNU make program.

I strongly advise that you not use maintenance mode to build any version you
want to use for anything other than developing GNU make itself.  The
README.git file explains:


NOTE! This method builds GNU make in "maintainer mode".  Make programs built
      in this mode it will be slower, possibly MUCH slower: there are various
      sanity checks enabled.  Further this mode assumes a modern GCC, GNU
      libc, and well-formed system headers and enables a high level of
      warnings AND enables -Werror to turn warnings into failures.

      If you want to build from Git with "maintainer mode" disabled, add
      "MAKE_MAINTAINER_MODE=" to the make command line.  If you want to turn
      off the extra warning flags, add "MAKE_CFLAGS=" to the make command
      line.

      For example:
        $ ./configure
        $ make check MAKE_MAINTAINER_MODE= MAKE_CFLAGS=
        $ make install


I'm not sure I want to update the configure.ac to test for the -C option
specifically and avoid it if not available, since it's only used in maintainer
mode.



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58743>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply | Threaded
Open this post in threaded view
|

[bug #58743] siggetmask should be called with no arguments.

David Boyce-5
Follow-up Comment #5, bug #58743 (project make):

I forgot to say: this is only relevant for code checked out from Git.  It's
actually not even possible to enable maintainer mode for release tarballs
downloaded from ftp.gnu.org: the code for it isn't included in the release
tarball.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58743>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply | Threaded
Open this post in threaded view
|

[bug #58743] siggetmask should be called with no arguments.

David Boyce-5
Follow-up Comment #6, bug #58743 (project make):

That's fine with me.
I was using git to test your recent changes on Raspberry (arm) and now confirm
it works well. I was not aware it builds gnumake in maintenance mode.

Thanks your for your help and support.

Christian

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58743>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply | Threaded
Open this post in threaded view
|

[bug #58743] siggetmask should be called with no arguments.

David Boyce-5
Follow-up Comment #7, bug #58743 (project make):

FYI I just pushed -C (empty) support to tcc git.
tcc has already several gcc compatible options that are accepted but dropped
in order to support gcc plug and play replacement.

Now, with or without maintainer mode, gnumake compiles ROOTB from git with
tcc.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58743>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/