public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
* Repeated ERRORS (was: A typo report in socket(2))
       [not found] <CAFxh5QD20xDA0DXYOw9EyWAzN4PCxy8SPEN4zx=rfCieYFgA4w@mail.gmail.com>
@ 2022-08-31 12:01 ` Alejandro Colomar
  2022-08-31 12:05   ` Alejandro Colomar
  0 siblings, 1 reply; 2+ messages in thread
From: Alejandro Colomar @ 2022-08-31 12:01 UTC (permalink / raw)
  To: Violeta Kabadzhova; +Cc: linux-man, mtk.manpages


[-- Attachment #1.1: Type: text/plain, Size: 6512 bytes --]

Hi Violeta,

On 8/31/22 09:02, Violeta Kabadzhova wrote:
> Hello,
> 
> According to the Reporting man pages bug 
> <https://www.kernel.org/doc/man-pages/reporting_bugs.html> article, in 
> case of a spotted typo (one-liner), one should write to the maintainers 
> and CC the current mailing list.

Well done.  Ideally, you should send plain text emails, since the 
mailing list discards HTML email, but I understand that some tools are 
not friendly to send plain text emails, so don't worry.

> 
> In the socket(2) 
> <https://man7.org/linux/man-pages/man2/socket.2.html>::ERRORS man page 
> there's a duplicate EINVAL (depicted below).
> image.png

That's because socket(2) will set errno to EINVAL if any of those two 
situations happen.  I know it's a bit weird the first time you see it, 
but you get used to it.  I don't know of a better way to express it 
concisely, and other Unix systems seem to do the same thing[1].

[1]: <https://man.openbsd.org/clock_getres.2#ERRORS>

I got a list of all of the duplicate errors, which I used to compare it 
to the OpenBSD manual pages.  I'll share it here so that it's easier to 
remember if I need to.

The below script makes use of man_section(), defined in 
<scripts/bash_aliases> in the man-pages repository, for which I also 
copied the definition below.


Cheers,

Alex


> Best,
> Violeta


man_section()
{
	if [ $# -lt 2 ]; then
		>&2 echo "Usage: ${FUNCNAME[0]} <dir> <section>...";
		return $EX_USAGE;
	fi

	local page="$1";
	shift;
	local sect="$*";

	find "$page" -type f \
	|xargs wc -l \
	|grep -v -e '\b1 ' -e '\btotal\b' \
	|awk '{ print $2 }' \
	|sort \
	|while read -r manpage; do
		(sed -n '/^\.TH/,/^\.SH/{/^\.SH/!p}' <"$manpage";
		 for s in $sect; do
			<"$manpage" \
			sed -n \
				-e "/^\.SH $s/p" \
				-e "/^\.SH $s/,/^\.SH/{/^\.SH/!p}";
		 done;) \
		|man -P cat -l - 2>/dev/null;
	done;
}


And the list is:


$ man_section man2 ERRORS \
   | grep -e '^\w*(2)' -e '^       E' \
   | grep -o '^ *[^ ]*' \
   | sed '/^\w/p' \
   | uniq -d \
   | tac \
   | sed -n '/^ /,/^[^ ]/p' \
   | tac;
ACCEPT(2)
        EINVAL
ACCESS(2)
        EINVAL
        ENOTDIR
ADD_KEY(2)
        EINVAL
        EPERM
ADJTIMEX(2)
        EINVAL
BIND(2)
        EADDRINUSE
        EINVAL
BPF(2)
        EINVAL
CAPGET(2)
        EPERM
CHMOD(2)
        EBADF
        ENOTDIR
        EPERM
CHOWN(2)
        EBADF
        ENOTDIR
        EPERM
CLOCK_GETRES(2)
        EINVAL
CLOCK_NANOSLEEP(2)
        EINVAL
CLONE(2)
        EINVAL
        ENOSPC
        EPERM
COPY_FILE_RANGE(2)
        EBADF
        EFBIG
        EINVAL
        EXDEV
DUP(2)
        EBADF
        EINVAL
EPOLL_CREATE(2)
        EINVAL
        EMFILE
EPOLL_CTL(2)
        EINVAL
EXECVE(2)
        EACCES
        ELOOP
        EPERM
FALLOCATE(2)
        EFBIG
        EINVAL
        EPERM
FANOTIFY_INIT(2)
        EMFILE
FANOTIFY_MARK(2)
        EBADF
        EINVAL
        ENOTDIR
FCNTL(2)
        EBADF
        EBUSY
        EINTR
        EINVAL
        EPERM
FORK(2)
        EAGAIN
        ENOMEM
FUTEX(2)
        EAGAIN
        EDEADLK
        EINVAL
        ENOSYS
        EPERM
        ESRCH
GETGROUPS(2)
        EINVAL
        EPERM
GETRLIMIT(2)
        EPERM
GETTIMEOFDAY(2)
        EINVAL
INOTIFY_INIT(2)
        EMFILE
IOCTL(2)
        ENOTTY
KEXEC_LOAD(2)
        EADDRNOTAVAIL
        EINVAL
KEYCTL(2)
        EDEADLK
        EINVAL
        ENOENT
        ENOKEY
        EOPNOTSUPP
        EPERM
LINK(2)
        EPERM
        ENOENT
LISTEN(2)
        EADDRINUSE
MADVISE(2)
        EINVAL
        ENOMEM
MEMFD_CREATE(2)
        EINVAL
MEMFD_SECRET(2)
        EMFILE
MINCORE(2)
        ENOMEM
MKDIR(2)
        ENOSPC
        ENOTDIR
MKNOD(2)
        ENOTDIR
MLOCK(2)
        EINVAL
        ENOMEM
        EPERM
MMAP(2)
        EINVAL
        ENOMEM
        EPERM
MOUNT(2)
        EACCES
        EBUSY
        EINVAL
        ELOOP
        EPERM
MOUNT_SETATTR(2)
        EBADF
        EBUSY
        EINVAL
        EPERM
MPROTECT(2)
        EINVAL
        ENOMEM
MSGCTL(2)
        EPERM
MSGOP(2)
        EINVAL
        ENOMSG
OPEN(2)
        EACCES
        EINVAL
        EISDIR
        ELOOP
        ENOENT
        ENOMEM
        ENOTDIR
        ENXIO
        EPERM
        ETXTBSY
OPEN_BY_HANDLE_AT(2)
        EINVAL
        EBADF
OPENAT2(2)
        EAGAIN
        EINVAL
        ELOOP
        EXDEV
PIDFD_GETFD(2)
        EBADF
PIDFD_OPEN(2)
        EINVAL
PIDFD_SEND_SIGNAL(2)
        EINVAL
        EPERM
PIPE(2)
        ENFILE
PIVOT_ROOT(2)
        EINVAL
POLL(2)
        EINVAL
PRCTL(2)
        EACCES
        EFAULT
        EINVAL
        ENXIO
        EPERM
PROCESS_MADVISE(2)
        EINVAL
PROCESS_VM_READV(2)
        EFAULT
        EINVAL
QUOTACTL(2)
        EINVAL
        ESRCH
READ(2)
        EAGAIN
        EINVAL
READLINK(2)
        EINVAL
        ENOTDIR
READV(2)
        EINVAL
REMAP_FILE_PAGES(2)
        EINVAL
RENAME(2)
        EINVAL
REQUEST_KEY(2)
        EINVAL
RMDIR(2)
        EPERM
RT_SIGQUEUEINFO(2)
        EPERM
S390_PCI_MMIO_WRITE(2)
        EFAULT
S390_RUNTIME_INSTR(2)
        EINVAL
SCHED_SETAFFINITY(2)
        EINVAL
SCHED_SETATTR(2)
        EPERM
SCHED_SETPARAM(2)
        EINVAL
SCHED_SETSCHEDULER(2)
        EINVAL
SECCOMP(2)
        EINVAL
        ENOMEM
SELECT(2)
        EINVAL
SEMGET(2)
        EINVAL
SEND(2)
        EAGAIN
SENDFILE(2)
        EINVAL
SETNS(2)
        EINVAL
SETRESUID(2)
        EAGAIN
SETREUID(2)
        EAGAIN
SETUID(2)
        EAGAIN
SETXATTR(2)
        ENOTSUP
SHMGET(2)
        EINVAL
SIGNALFD(2)
        EINVAL
SOCKET(2)
        EINVAL
SPLICE(2)
        EINVAL
STAT(2)
        EBADF
        ENOENT
        ENOTDIR
STATX(2)
        EINVAL
SWAPON(2)
        EINVAL
SYMLINK(2)
        ENOENT
        ENOTDIR
TIMER_SETTIME(2)
        EINVAL
TIMERFD_CREATE(2)
        EINVAL
        EINVAL
TKILL(2)
        EAGAIN
TRUNCATE(2)
        EPERM
        EBADF
        EINVAL
UMOUNT(2)
        EINVAL
UNLINK(2)
        EPERM
UNSHARE(2)
        EINVAL
        ENOSPC
        EPERM
UTIME(2)
        EACCES
UTIMENSAT(2)
        EBADF
        EINVAL
WAIT(2)
        ECHILD
WRITE(2)
        EAGAIN


-- 
Alejandro Colomar
<http://www.alejandro-colomar.es/>

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Repeated ERRORS (was: A typo report in socket(2))
  2022-08-31 12:01 ` Repeated ERRORS (was: A typo report in socket(2)) Alejandro Colomar
@ 2022-08-31 12:05   ` Alejandro Colomar
  0 siblings, 0 replies; 2+ messages in thread
From: Alejandro Colomar @ 2022-08-31 12:05 UTC (permalink / raw)
  To: linux-man; +Cc: mtk.manpages, Violeta Kabadzhova


[-- Attachment #1.1: Type: text/plain, Size: 1991 bytes --]

On 8/31/22 14:01, Alejandro Colomar wrote:
> man_section()
> {
>      if [ $# -lt 2 ]; then
>          >&2 echo "Usage: ${FUNCNAME[0]} <dir> <section>...";
>          return $EX_USAGE;
>      fi
> 
>      local page="$1";
>      shift;
>      local sect="$*";
> 
>      find "$page" -type f \
>      |xargs wc -l \
>      |grep -v -e '\b1 ' -e '\btotal\b' \
>      |awk '{ print $2 }' \
>      |sort \
>      |while read -r manpage; do
>          (sed -n '/^\.TH/,/^\.SH/{/^\.SH/!p}' <"$manpage";
>           for s in $sect; do
>              <"$manpage" \
>              sed -n \
>                  -e "/^\.SH $s/p" \
>                  -e "/^\.SH $s/,/^\.SH/{/^\.SH/!p}";
>           done;) \
>          |man -P cat -l - 2>/dev/null;
>      done;
> }
> 
> 
> And the list is:

And the list for man3 is a bit shorter:


$ man_section man3 ERRORS | grep -e '^\w*(3)' -e '^       E' | grep -o 
'^ *[^ ]*' | sed '/^\w/p' | uniq -d | tac | sed -n '/^ /,/^[^ ]/p' | tac 
| tee /dev/tty | wc -l
FPATHCONF(3)
        EINVAL
FUTIMES(3)
        ENOSYS
GETCWD(3)
        EINVAL
GETENTROPY(3)
        EIO
KILLPG(3)
        ESRCH
LIO_LISTIO(3)
        EAGAIN
MKFIFO(3)
        ENOTDIR
MQ_OPEN(3)
        EACCES
        EINVAL
        ENOENT
NEWLOCALE(3)
        EINVAL
POSIX_MADVISE(3)
        EINVAL
PTHREAD_ATTR_SETAFFINITY_NP(3)
        EINVAL
PTHREAD_CREATE(3)
        EAGAIN
PTHREAD_JOIN(3)
        EINVAL
PTHREAD_SETAFFINITY_NP(3)
        EINVAL
PTHREAD_SETCANCELSTATE(3)
        EINVAL
PTHREAD_SETNAME_NP(3)
        ERANGE
RANDOM(3)
        EINVAL
RANDOM_R(3)
        EINVAL
SCANDIR(3)
        ENOTDIR
SEM_OPEN(3)
        EINVAL
SEM_WAIT(3)
        EINVAL
SHM_OPEN(3)
        EACCES
        ENOENT
47


-- 
Alejandro Colomar
<http://www.alejandro-colomar.es/>

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-31 12:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CAFxh5QD20xDA0DXYOw9EyWAzN4PCxy8SPEN4zx=rfCieYFgA4w@mail.gmail.com>
2022-08-31 12:01 ` Repeated ERRORS (was: A typo report in socket(2)) Alejandro Colomar
2022-08-31 12:05   ` Alejandro Colomar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox