Opened 4 years ago

Closed 2 months ago

#62304 closed defect (fixed)

sudosh @1.6.3: error: implicit declaration of function 'gettimeofday' is invalid in C99

Reported by: cooljeanius (Eric Gallager) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: bigsur catalina Cc: mascguy (Christopher Nielsen)
Port: sudosh

Description

Another victim of -Werror=implicit-function-declaration being on by default now:

Making all in src
make[2]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_shells_sudosh/sudosh/work/sudosh-1.6.3/src'
if /usr/bin/clang -DHAVE_CONFIG_H -I. -I. -I..   -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk  -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64 -MT sudosh.o -MD -MP -MF ".deps/sudosh.Tpo" -c -o sudosh.o sudosh.c; \
	then mv -f ".deps/sudosh.Tpo" ".deps/sudosh.Po"; else rm -f ".deps/sudosh.Tpo"; exit 1; fi
if /usr/bin/clang -DHAVE_CONFIG_H -I. -I. -I..   -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk  -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -arch x86_64 -MT rand.o -MD -MP -MF ".deps/rand.Tpo" -c -o rand.o rand.c; \
	then mv -f ".deps/rand.Tpo" ".deps/rand.Po"; else rm -f ".deps/rand.Tpo"; exit 1; fi
rand.c:12:5: error: implicit declaration of function 'gettimeofday' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    gettimeofday(&tv, NULL);
    ^
1 error generated.
sudosh.c:248:24: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
    while (user.vshell = (char *) getusershell()) {
           ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
sudosh.c:248:24: note: place parentheses around the assignment to silence this warning
    while (user.vshell = (char *) getusershell()) {
                       ^
           (                                    )
sudosh.c:248:24: note: use '==' to turn this assignment into an equality comparison
    while (user.vshell = (char *) getusershell()) {
                       ^
                       ==
sudosh.c:286:144: warning: format specifies type 'int' but the argument has type 'time_t' (aka 'long') [-Wformat]
    snprintf(script.name, (size_t) BUFSIZ - 1, "%s/%s%s%s%sscript%s%i%s%s", LOGDIR, user.from, FILEDELIMIT, user.to, FILEDELIMIT, FILEDELIMIT, now, FILEDELIMIT, rand);
                                                                   ~~                                                                          ^~~
                                                                   %li
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:57:62: note: expanded from macro 'snprintf'
  __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
                                                             ^~~~~~~~~~~
sudosh.c:287:142: warning: format specifies type 'int' but the argument has type 'time_t' (aka 'long') [-Wformat]
    snprintf(timing.name, (size_t) BUFSIZ - 1, "%s/%s%s%s%stime%s%i%s%s", LOGDIR, user.from, FILEDELIMIT, user.to, FILEDELIMIT, FILEDELIMIT, now, FILEDELIMIT, rand);
                                                                 ~~                                                                          ^~~
                                                                 %li
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:57:62: note: expanded from macro 'snprintf'
  __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
                                                             ^~~~~~~~~~~
sudosh.c:288:142: warning: format specifies type 'int' but the argument has type 'time_t' (aka 'long') [-Wformat]
    snprintf(input.name, (size_t) BUFSIZ - 1, "%s/%s%s%s%sinput%s%i%s%s", LOGDIR, user.from, FILEDELIMIT, user.to, FILEDELIMIT, FILEDELIMIT, now, FILEDELIMIT, rand);
                                                                 ~~                                                                          ^~~
                                                                 %li
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:57:62: note: expanded from macro 'snprintf'
  __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
                                                             ^~~~~~~~~~~
sudosh.c:374:3: error: implicit declaration of function 'do_write' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                WRITE(1, iobuf, n);
                ^
sudosh.c:83:24: note: expanded from macro 'WRITE'
#define WRITE(a, b, c) do_write(a, b, c, __FILE__, __LINE__)
                       ^
make[2]: *** [rand.o] Error 1
make[2]: *** Waiting for unfinished jobs....
sudosh.c:381:3: error: implicit declaration of function 'do_write' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                WRITE(timing.fd, &timing.str, strlen(timing.str));
                ^
sudosh.c:83:24: note: expanded from macro 'WRITE'
#define WRITE(a, b, c) do_write(a, b, c, __FILE__, __LINE__)
                       ^
sudosh.c:388:3: error: implicit declaration of function 'do_write' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                WRITE(pspair.mfd, iobuf, n);
                ^
sudosh.c:83:24: note: expanded from macro 'WRITE'
#define WRITE(a, b, c) do_write(a, b, c, __FILE__, __LINE__)
                       ^
sudosh.c:495:12: error: implicit declaration of function 'ioctl' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    (void) ioctl(0, TIOCSWINSZ, &winorig);
           ^
sudosh.c:539:9: error: implicit declaration of function 'ioctl' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if (ioctl(ttyfd, TIOCGWINSZ, &winorig) == -1) {
        ^
sudosh.c:577:9: error: implicit declaration of function 'ioctl' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if (ioctl(0, TIOCGWINSZ, &winorig) != -1) {
        ^
sudosh.c:648:11: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
    if (s = write(fd, buf, size) < 0) {
        ~~^~~~~~~~~~~~~~~~~~~~~~~~~~
sudosh.c:648:11: note: place parentheses around the assignment to silence this warning
    if (s = write(fd, buf, size) < 0) {
          ^
        (                           )
sudosh.c:648:11: note: use '==' to turn this assignment into an equality comparison
    if (s = write(fd, buf, size) < 0) {
          ^
          ==
5 warnings and 6 errors generated.
make[2]: *** [sudosh.o] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_shells_sudosh/sudosh/work/sudosh-1.6.3/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_shells_sudosh/sudosh/work/sudosh-1.6.3'
make: *** [all] Error 2
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_shells_sudosh/sudosh/work/sudosh-1.6.3'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_shells_sudosh/sudosh/work/sudosh-1.6.3" && /usr/bin/make -j16 -w all 
Exit code: 2
Error: Failed to build sudosh: command execution failed
DEBUG: Error code: CHILDSTATUS 61728 2

Change History (6)

comment:1 Changed 3 years ago by cooljeanius (Eric Gallager)

The header to include for gettimeofday is <sys/time.h>, for reference.

comment:2 Changed 3 years ago by reneeotten (Renee Otten)

the port is nomaintainer, so if you know how to fix this - please do submit a PR!

comment:3 Changed 3 years ago by cooljeanius (Eric Gallager)

so, I did a livecheck and found that there's an update to version 2.0.00 available, but after fixing the checksums and configuration, it then fails with a different error about missing OpenSSL declarations... should I focus on patching the existing (old) version, or keep trying to write an update to the new version?

comment:4 Changed 2 years ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:5 Changed 2 months ago by ryandesign (Ryan Carsten Schmidt)

There is no version 2.0.00 available. livecheck claims there is, but it's actually the 2006 version 2.0.00 of something called eas which does not appear to be the same thing. The file is not listed in the SourceForge project's files tab though it can be downloaded from the URL in the RSS feed. There is a separate sudosh2 port. Its README says "sudosh2 was forked from sudosh, which was pulled by its original developer when a commercial company bought it from him." So I don't expect any new releases of the original sudosh and we should disable the livecheck.

comment:6 Changed 2 months ago by ryandesign (Ryan Carsten Schmidt)

Owner: set to ryandesign
Resolution: fixed
Status: newclosed

In 4675957cb6804185fd526f0d9d81db5d3d9a0f00/macports-ports (master):

sudosh: Fix implicit function declarations

Closes: #62304

Note: See TracTickets for help on using tickets.