directory permissions [was: 'syslogd -u' and pidfile creation]

2024-11-08 Thread Jan Schaumann
Robert Elz wrote: > I agree this is mostly harmless (though annoying) - but leads me to > ponder whether or not we should have a directory permission setting > which would allow anyone to remove their own files from a directory, > but not create any (assuming they don't also have write permission

Re: 'syslogd -u' and pidfile creation

2024-11-08 Thread Jan Schaumann
Mouse wrote: > > [I]f you use 'syslogd -u user', then syslogd can't create a pidfile > > because that is done post-setuid. > > What is the intended use case for -u? To run syslogd as an unprivileged user rather than as root. It starts up as root to open the log sockets, then changes euid to the

'syslogd -u' and pidfile creation

2024-11-08 Thread Jan Schaumann
Hello, 20 years ago, I filed bin/27309. In short, if you use 'syslogd -u user', then syslogd can't create a pidfile because that is done post-setuid. My suggested fix (diff attached) is to create the pidfile and chown it before changing UIDs. The subsequent pidfile(3) call will happily take ove

Re: `ls -1s` doesn't print "total"

2024-11-04 Thread Jan Schaumann
Jan Schaumann wrote: > Valery Ushakov wrote: > > > I'd say -1 is the option for "the output is meant to read > > programmatically" and it's antonym is -C for "the output for human > > consumption". If ls outputs to a pipe it infers -1 aut

Re: `ls -1s` doesn't print "total"

2024-11-03 Thread Jan Schaumann
Valery Ushakov wrote: > I'd say -1 is the option for "the output is meant to read > programmatically" and it's antonym is -C for "the output for human > consumption". If ls outputs to a pipe it infers -1 automatically > unless -C is specified (cf. "command ls | more"). The total is "for > human

`ls -1s` doesn't print "total"

2024-11-03 Thread Jan Schaumann
Hi, It looks like `ls -1s` (single-column + '-s') does not print the "total" summary. The manual page describes both flags as follows: -1 (The numeric digit "one"). Force output to be one entry per line. This is the default when output is not to a terminal. -s Displa

Re: lseek on tty

2023-09-18 Thread Jan Schaumann
Mouse wrote: > > On NetBSD and macOS, lseek(2) on a tty succeeds: > > > if (lseek(STDIN_FILENO, 0, SEEK_CUR) == -1 ) > > > On Linux, this fails. > > > I'm trying to think of why seeking on a terminal would make sense. > > Anybody have an idea? > > Quoting from lseek(2) on a handy machi

lseek on tty

2023-09-18 Thread Jan Schaumann
Hi, On NetBSD and macOS, lseek(2) on a tty succeeds: int main() { if (lseek(STDIN_FILENO, 0, SEEK_CUR) == -1 ) fprintf(stderr, "cannot seek\n"); } $ ./a.out

Re: split(1): add '-c' to continue creating files

2023-02-14 Thread Jan Schaumann
Robert Elz wrote: > Most of the rest of this proposal is (a disaster) - it is far too > complicated with two many pitfalls, for very little rational benefit. ¯\_(ツ)_/¯ -Jan

Re: split(1): add '-c' to continue creating files

2023-02-14 Thread Jan Schaumann
Martin Husemann wrote: > How about instead adding an option that sets the first name explicitly > and keeps the "abort on failure" behaviour? Setting the first name is a good alternative. I'll have to see how that works with specifying a prefix (e.g., user specified a first file that doesn't ma

Re: split(1): add '-c' to continue creating files

2023-02-14 Thread Jan Schaumann
Ignatios Souvatzis wrote: > Definitely O_EXCL and EEXIST, yes. But we still can fall into a hole > in the sequence, fill it, and skip over the remaining part(s), thus > interleaving our new and the preexisting files. Ah, you mean if I currently have $ ls xaa xad xae and then run $ split -n 4

Re: split(1): add '-c' to continue creating files

2023-02-12 Thread Jan Schaumann
Jan Schaumann wrote: > The attached diff adds a flag "-c" (mnemonic "create, > don't overwrite" or "continue where you left off"): Ugh, and once more without a race condition. -Jan Index: split.1 =

split(1): add '-c' to continue creating files

2023-02-12 Thread Jan Schaumann
Hello, Currently, split(1) will clobber any existing output files: $ split file; ls xaa xab xac xad $ split second-file; ls xaa xab xac xad xae xaf I often would like for it to pick up where it left off and continue creating files in the sequence. Right now, there is no good way for me to yield

Re: split(1): auto-extend suffix length

2023-01-30 Thread Jan Schaumann
ignat...@cs.uni-bonn.de wrote: > hi, > > On Sun, Jan 29, 2023 at 05:45:15PM -0500, Jan Schaumann wrote: > > > +* sfxlen by one, thereby yielding an additional two characters > > +* and allowing all output files to sort such that 'cat *' yields > &g

split(1): auto-extend suffix length

2023-01-29 Thread Jan Schaumann
Hello, When running split(1) such that it would require more files than the default suffix-length would allow, it currently errors out with 'too many files'. For example, if I have a file with 1 million lines and run split file then split(1) will generate 676 files 'xaa' through 'xzz' and then

warn against strcpy(3)

2022-10-03 Thread Jan Schaumann
Hello, On macOS, the strcpy(3) manual page contains the following "Admonishment" prominently displayed immediately after the Synopsis: YOU SHOULD ALMOST CERTAINLY USE strlcpy() INSTEAD. See "Examples" below. (Likewise for strcat(3).) I find this a rather effective way of discouraging its use es

Re: sh(1) and ksh(1) default PATH

2022-08-15 Thread Jan Schaumann
Robert Elz wrote: > In all of this we can adopt the attitude "all the users are morons and > cannot make a decision, or configure things even if they knew what they > wanted to configure, so we will decide for them" which some other systems > are doing. > > That certainly makes it easier for the

toor shell

2020-09-23 Thread Jan Schaumann
Hello, Picking up an old inquiry from wiz@ from... 2013: https://mail-index.netbsd.org/tech-userlevel/2013/12/04/msg008256.html It looks like NetBSD still ships a password file with toor and root having the same shell, which seems to defeat the point of the toor account. (FreeBSD currently ships