Opened 3 years ago

Closed 3 years ago

#61515 closed defect (fixed)

zsh @5.8: wrong configure results because of implicit function declarations

Reported by: joelburton (Joel Burton) Owned by: larryv (Lawrence Velázquez)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: bigsur catalina Cc: fracai, libsystem-ethan
Port: zsh

Description (last modified by ryandesign (Ryan Carsten Schmidt))

tart zsh without rcs (this should start a new shell):

/usr/local/bin/zsh --no-rcs

try to enter the following in the new shell (it should hang):

echo $(date)

To me it seems like all command substitution using $() causes zsh to hang. Backticks seem to work though.

(Copying report from https://github.com/Homebrew/discussions/discussions/141 ; this is about a problem with Homebrew, but I'm getting the same behavior with MacPorts0.

Attachments (1)

explicit-declarations.patch (6.3 KB) - added by larryv (Lawrence Velázquez) 3 years ago.
adaptation of upstream's fix

Download all attachments as: .zip

Change History (10)

comment:1 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Owner: set to larryv
Status: newassigned

If you see the same problem with zsh regardless whether zsh is installed with MacPorts or Homebrew, that suggests a bug in zsh that should be reported to the developers of zsh. You could also check whether you get the same problem with /bin/zsh as provided by Apple, but even if you don't, that doesn't mean it's not a zsh bug; Apple probably modifies their zsh just as they modify all of the software they ship with macOS.

Last edited 3 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:2 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Per the fix that Homebrew committed, it was a problem with implicit function declarations: a common problem we are seeing with many, many ports under Xcode 12. Whereas Homebrew chose to downgrade the error to a warning, the correct fix is to include the right headers so that the function declarations are provided. Not doing so can spell trouble for Apple Silicon systems.

comment:3 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

$ grep \ implicit -r work/zsh-5.8/config.log
work/zsh-5.8/config.log:conftest.c:225:14: error: implicit declaration of function 'tgetent' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:230:6: error: implicit declaration of function 'tgetstr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:231:2: error: implicit declaration of function 'creat' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:233:5: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:225:14: error: implicit declaration of function 'tgetent' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:230:6: error: implicit declaration of function 'tgetstr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:231:2: error: implicit declaration of function 'creat' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:233:5: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:251:24: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:251:40: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:283:5: error: implicit declaration of function 'unlink' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:285:8: error: implicit declaration of function 'mkfifo' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:289:2: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:290:11: error: implicit declaration of function 'fork' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:295:17: error: implicit declaration of function 'read' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:298:22: error: implicit declaration of function 'write' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:287:2: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:283:5: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:298:9: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:282:5: error: implicitly declaring library function 'sprintf' with type 'int (char *, const char *, ...)' [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:282:27: error: implicit declaration of function 'getpid' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:282:37: error: implicit declaration of function 'rand' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:284:14: error: implicitly declaring library function 'strcpy' with type 'char *(char *, const char *)' [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:287:5: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:287:31: error: implicitly declaring library function 'strcmp' with type 'int (const char *, const char *)' [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:293:5: error: implicit declaration of function 'read' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
work/zsh-5.8/config.log:conftest.c:315:13: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]

comment:4 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Keywords: catalina added
Summary: Brew zsh hangs on $(...) command substitution in Big Sur 11.0.1zsh @5.8: wrong configure results because of implicit function declarations

Changed 3 years ago by larryv (Lawrence Velázquez)

Attachment: explicit-declarations.patch added

adaptation of upstream's fix

comment:5 in reply to:  2 ; Changed 3 years ago by larryv (Lawrence Velázquez)

Upstream has committed a fix to the development repository, and I've tried adapting it for the distribution. Let me know if it works correctly (I'm still on Mojave!), and I'll push it.

diff --git a/shells/zsh/Portfile b/shells/zsh/Portfile
index 969e32a97c4..4a3acd4563f 100644
--- a/shells/zsh/Portfile
+++ b/shells/zsh/Portfile
@@ -4,6 +4,7 @@ PortSystem              1.0
 
 name                    zsh
 version                 5.8
+revision                1
 categories              shells
 platforms               darwin
 license                 Permissive
@@ -47,7 +48,8 @@ checksums               ${distname}${extract.suffix} \
                             sha256  9b4e939593cb5a76564d2be2e2bfbb6242509c0c56fd9ba52f5dba6cf06fdcc4 \
                             size    3088696
 
-patchfiles              prevent-doc-regeneration.patch
+patchfiles              prevent-doc-regeneration.patch \
+                        explicit-declarations.patch
 
 set docdir ${prefix}/share/doc/${name}

Replying to ryandesign:

Whereas Homebrew chose to downgrade the error to a warning, the correct fix is to include the right headers so that the function declarations are provided.

If my distribution patch works, they are free to use it if they wish.

comment:6 Changed 3 years ago by fracai

Cc: fracai added

comment:7 Changed 3 years ago by libsystem-ethan

Cc: libsystem-ethan added

comment:8 in reply to:  5 Changed 3 years ago by runar

Replying to larryv:

Upstream has committed a fix to the development repository, and I've tried adapting it for the distribution. Let me know if it works correctly (I'm still on Mojave!), and I'll push it.

Your patch fixed the issue for me, thank you. I'm on macOS 11.0.1 and was unable to use zsh (5.8) before applying your patch and reinstalling.

comment:9 Changed 3 years ago by larryv (Lawrence Velázquez)

Resolution: fixed
Status: assignedclosed

In 0da55f0843791a1d971be752f404ac524ab72725/macports-ports (master):

zsh: Explicitly declare prototypes in configure

Required to build correctly with Xcode 12. Adapted from upstream fix
(https://sourceforge.net/p/zsh/code/ci/bd647c156549b2f666e5fae80f1ca674b6cde895/).

Closes: #61515

Note: See TracTickets for help on using tickets.