dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ryan Schmidt <dash@ryandesign.com>
To: dash@vger.kernel.org
Subject: Compatibility implementation of stpncpy for older systems
Date: Thu, 28 Mar 2024 18:23:07 -0500	[thread overview]
Message-ID: <858410A4-AFD5-4DBF-83BD-232C6F4B33AD@ryandesign.com> (raw)

Hello! dash 0.5.12 and the latest code in your git repository fails to build on older versions of macOS (Mac OS X 10.6.x and older). Using its default compiler (Apple's gcc 4.2.1) first this warning appears:

jobs.c: In function 'sprint_status':
jobs.c:434: warning: implicit declaration of function 'stpncpy'
jobs.c:434: warning: incompatible implicit declaration of built-in function 'stpncpy'

Then it fails at link time:

Undefined symbols:
  "_stpncpy", referenced from:
      _sprint_status in jobs.o
ld: symbol(s) not found

Using a newer compiler (llvm.org's clang 11.1.0) the warning is:

jobs.c:434:7: warning: implicitly declaring library function 'stpncpy' with type 'char *(char *, const char *, unsigned long)' [-Wimplicit-function-declaration]
                s = stpncpy(s, strsignal(st), 32);
                    ^
jobs.c:434:7: note: include the header <string.h> or explicitly provide a declaration for 'stpncpy'

And then a similar failure at link time:

Undefined symbols for architecture x86_64:
  "_stpncpy", referenced from:
      _sprint_status in jobs.o
ld: symbol(s) not found for architecture x86_64

The newer clang suggests including <string.h> because it knows the standard says that stpncpy would be declared there, but it won't help on Mac OS X 10.6.x and earlier because stpncpy was introduced in Mac OS X 10.7.

Would it be reasonable to add a compatibility implementation of stpncpy to dash? This and other changes were proposed here:

https://lore.kernel.org/dash/6cacf608-326e-211a-7d37-164041710980@knaff.lu/


                 reply	other threads:[~2024-03-28 23:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=858410A4-AFD5-4DBF-83BD-232C6F4B33AD@ryandesign.com \
    --to=dash@ryandesign.com \
    --cc=dash@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).