public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "adhemerval.zanella at linaro dot org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/26545] Deprecate getcwd (NULL, n) for positive n
Date: Wed, 02 Sep 2020 11:48:42 +0000	[thread overview]
Message-ID: <bug-26545-131-iFecK36gkB@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-26545-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=26545

--- Comment #5 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
(In reply to Florian Weimer from comment #4)
> (In reply to Adhemerval Zanella from comment #3)
> > But if the idea is not to change the function semantic in a future release
> > why deprecate it? My understanding is the GNU extension aims to make the
> > getcwd have the same semantic regarding the returned result, the only
> > difference is whether it would be allocated or not. I am not sure we should
> > deprecate it only because it does not fit the newer gcc warning annotation.
> 
> I think it's not a good programming practice because it prevents getcwd from
> sizing the buffer appropriately.

But the idea of exactly to limit the allocation to a certain limit, similar to
when you use provided a buffer.  It will either return an allocated buffer with
the asked size with the expand current directory or NULL. 

> 
> > One possibility is to make getcwd ignore the size argument if the buffer is
> > NULL, in this case the buffer will be always allocated to fit to obtained
> > path.
> 
> That would be a backwards-incompatible change.  Right now, programmers can
> use getcwd essentially as a malloc replacement.

That's why I asked if we should add a compat symbol.  I don't see much gain in
just document the behaviour as deprecated if we won't change the function
semantic.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2020-09-02 11:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-28  9:50 [Bug libc/26545] New: Deprecated " fweimer at redhat dot com
2020-08-28  9:51 ` [Bug libc/26545] " fweimer at redhat dot com
2020-08-31 20:18 ` adhemerval.zanella at linaro dot org
2020-09-01 12:55 ` fweimer at redhat dot com
2020-09-01 12:55 ` [Bug libc/26545] Deprecate " fweimer at redhat dot com
2020-09-01 13:53 ` adhemerval.zanella at linaro dot org
2020-09-02  6:25 ` fweimer at redhat dot com
2020-09-02 11:48 ` adhemerval.zanella at linaro dot org [this message]
2021-09-09  6:52 ` aurelien at aurel32 dot net
2021-09-11 20:05 ` jbglaw@lug-owl.de

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=bug-26545-131-iFecK36gkB@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).