Re: stpecpy(): A better string copy and concatenation function

2022-02-25 Thread Alejandro Colomar (man-pages)
Hello Ali, On 25/2/22 17:22, Ali Farzanrad wrote: "Alejandro Colomar (man-pages)" wrote: char dest[SIZE]; char *end; end = [SIZE - 1]; stpecpy(dest, "Hello world", end); Perfect way to introduce new hidden backdoors! Ju

Re: stpecpy(): A better string copy and concatenation function

2022-02-13 Thread Alejandro Colomar (man-pages)
Hi Theo, On 2/13/22 23:45, Theo de Raadt wrote: > Your proposal isn't an improvement over the current situation with strl* > functions, and I don't think this is helpful. > > Alejandro Colomar (man-pages) wrote: >>Compared to other string copy and concatenation functions

stpecpy(): A better string copy and concatenation function

2022-02-13 Thread Alejandro Colomar (man-pages)
Hi, Todd and Theo! I wrote this function this week, based on strlcpy(3) and strecopy()[1], which are the best string copy functions I've seen so far. But I came to improvements that bring one function that I think is better than both of those. I posted the function for review on

Re: Is getpass(3) really obsolete?

2021-10-30 Thread Alejandro Colomar (man-pages)
Hi Joseph, On 10/29/21 18:31, Joseph Myers wrote: On Fri, 29 Oct 2021, Alejandro Colomar (man-pages) via Libc-alpha wrote: The broader context is that I was trying to make the deprecation notices more consistent in the Linux manpages, by using the [[deprecated]] attribute where appropriate

Re: Is getpass(3) really obsolete?

2021-10-29 Thread Alejandro Colomar (man-pages)
Hi Randall, Theo, On 10/29/21 16:33, rsbec...@nexbridge.com wrote: October 29, 2031 10:21 AM, Theo de Raadt will write: wrote: getpass() is obsolete in POSIX.2. However, some platforms still are on POSIX.1, so replacing it instead of providing a configure detection/switch for it might

Re: Is getpass(3) really obsolete?

2021-10-29 Thread Alejandro Colomar (man-pages)
Hi Ævar, On 10/29/21 13:40, Ævar Arnfjörð Bjarmason wrote: On Fri, Oct 29 2021, Alejandro Colomar (man-pages) wrote: [Add a few CCs, since I mentioned them.] [I'm not sure what the full context of this thread is, but just replying from the POV of git@ being CC'd on this] The first

Re: Is getpass(3) really obsolete?

2021-10-29 Thread Alejandro Colomar (man-pages)
[Add a few CCs, since I mentioned them.] On 10/29/21 13:15, Alejandro Colomar wrote: Hi, As the manual pages says, SUSv2 marked it as LEGACY, and POSIX doesn't have it at all.  The manual page goes further and says "This function is obsolete. Do not use it." in its first lines. But, glibc

Re: Possible bug in lib/libc/gen/exec.c

2021-09-17 Thread Alejandro Colomar (man-pages)
Hello Theo, On 9/16/21 10:53 PM, Theo de Raadt wrote: @@ -45,25 +46,31 @@ execl(const char *name, const char *arg, { va_list ap; char **argv; - int n; + size_t maplen; + int save_errno, n, error; See below. va_start(ap, arg); n = 1;

Possible bug in lib/libc/gen/exec.c

2021-09-16 Thread Alejandro Colomar (man-pages)
Hi, I don't know if OpenBSD has a different implementation of alloca(3) than Linux. In Linux, alloca(3) (a.k.a. __builtin_alloca()) can't return NULL, as it can't detect errors. The only way to detect an error is to add a handler for SIGSEGV, AFAIK. I found the following code in :

Re: [RFC] strcpys(): New function for copying strings safely

2021-06-28 Thread Alejandro Colomar (man-pages)
On 6/28/21 1:32 PM, Alejandro Colomar (man-pages) wrote: The other use is where you want a sequence of: len *= str_copy(dest + len, dest_len - len, src); But don't really want to test for overflow after each call. This is a legitimate use of strscpy().  Please, add it to glibc

Re: [RFC] strcpys(): New function for copying strings safely

2021-06-28 Thread Alejandro Colomar (man-pages)
Hello David, On 6/28/21 10:15 AM, David Laight wrote: From: Alejandro Colomar Sent: 27 June 2021 20:47 On 6/27/21 9:26 PM, Alejandro Colomar (man-pages) wrote: It is designed so that usage requires the minimum number of lines of code for complete usage (including error handling checks

Re: [RFC] strcpys(): New function for copying strings safely

2021-06-27 Thread Alejandro Colomar (man-pages)
On 6/27/21 9:26 PM, Alejandro Colomar (man-pages) wrote: It is designed so that usage requires the minimum number of lines of code for complete usage (including error handling checks): [[ // When we already checked that 'size' is >= 1 // and truncation is not an issue: strcpys_np(size, d

[RFC] strcpys(): New function for copying strings safely

2021-06-27 Thread Alejandro Colomar (man-pages)
Hi, I recently re-read the discussions about strscpy() and strlcpy(). https://lwn.net/Articles/612244/ https://sourceware.org/legacy-ml/libc-alpha/2000-08/msg00052.html https://mafford.com/text/the-many-ways-to-copy-a-string-in-c/ https://lkml.org/lkml/2017/7/14/637

Re: [PATCH v3 (resend)] tee: Add -q, --quiet, --silent option to not write to stdout

2021-01-24 Thread Alejandro Colomar (man-pages)
On 1/24/21 5:11 PM, Teran McKinney wrote: > On 2021-01-24 13-18-46, Alejandro Colomar wrote: >> This is useful for using tee to just write to a file, >> at the end of a pipeline, >> without having to redirect to /dev/null >> >> Example: >> >> echo 'foo' | sudo tee -q /etc/foo; >> >> is

Re: [PATCH v2] tee: Add -q, --quiet, --silent option to not write to stdout

2021-01-23 Thread Alejandro Colomar (man-pages)
On 1/23/21 5:19 PM, Anders Damsgaard wrote: > (lots of Cc's removed) > > * Alejandro Colomar [2021-01-22 00:12:58 +0100]: > >> This is useful for using tee to just write to a file, >> at the end of a pipeline, >> without having to redirect to /dev/null. >> >> Example: >> echo 'foo' | sudo

Re: [PATCH v2] tee: Add -q, --quiet, --silent option to not write to stdout

2021-01-22 Thread Alejandro Colomar (man-pages)
I added a few FreeBSD CCs that I found on their tee.c's git blame, because the freebsd list rejects external mail. Please have a look at the proposal below, and the discussion that started on gnu coreutil's list. On 1/22/21 12:12 AM, Alejandro Colomar wrote: This is useful for using tee to

Re: [PATCH] tee: Add -q, --quiet option to not write to stdout

2021-01-21 Thread Alejandro Colomar (man-pages)
[CC += mtk, linux-api, freebsd, openbsd] On 1/21/21 10:26 PM, Alejandro Colomar (man-pages) wrote: > Hi Berny, > > On 1/21/21 10:01 PM, Bernhard Voelker wrote: >> On 1/21/21 7:39 PM, Alex Henrie wrote: >>> That said, I would love to see `tee -q` added to a futu