Re: [PATCH] ioctl.2: note "int request" form, HISTORYise a bit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 2023-09-13 18:02, наб wrote:
> Bit me in https://github.com/thecoshman/http/issues/155:

Be careful with URIs.  They _must_ be enclosed within <>.  See uri(7).
Otherwise, the ':' can be understood as part of the URI.

From RFC 9110:

	http-URI = "http" "://" authority path-abempty [ "?" query ]

path-abempty is defined in RFC 3986:

	path-abempty  = *( "/" segment )
	segment       = *pchar
	pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"

As you can see, ':' is allowed in a URI path.

For your curiosity, here's the definition of other elements, per RFC 3986 too:

	unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~"
	pct-encoded   = "%" HEXDIG HEXDIG
	sub-delims    = "!" / "$" / "&" / "'" / "(" / ")"
	              / "*" / "+" / "," / ";" / "="

	reserved      = gen-delims / sub-delims
	gen-delims    = ":" / "/" / "?" / "#" / "[" / "]" / "@"


Here's what uri(7) has to say:

   Writing a URI
     When written, URIs should be placed inside double  quotes  (e.g.,
     "http://www.kernel.org";),   enclosed  in  angle  brackets  (e.g.,
     <http://lwn.net>), or placed on a line by themselves.  A  warning
     for  those  who use double‐quotes: never move extraneous punctua‐
     tion (such as the period ending a sentence  or  the  comma  in  a
     list)  inside a URI, since this will change the value of the URI.
     Instead, use angle brackets instead, or switch to a quoting  sys‐
     tem  that  never  includes extraneous characters inside quotation
     marks.  This latter system, called the ’new’ or ’logical’ quoting
     system by "Hart’s Rules" and the "Oxford Dictionary  for  Writers
     and Editors", is preferred practice in Great Britain and in vari‐
     ous  European languages.  Older documents suggested inserting the
     prefix "URL:" just before the URI, but this form has never caught
     on.

> musl (and, thus, bionic) takes an int!
> 
> Kill the "POSIX says 'request' is int" comment;
> prior to Issue 7, ioctl() is shaded STREAMS,
> it's obsolescent in Issue 7,
> and gone completely in Issue 8.
> The POSIX interface has never been supported by Linux,
> and the common ioctl() interface has never existed in POSIX or the SUS.
> 
> Note how the interface evolved in HISTORY. The NetBSD CVS has
>   revision 1.1
>   date: 1993-03-21 10:45:37 +0100;  author: cgd;  state: Exp;
>   branches:  1.1.1;
>   Initial revision
>   ----------------------------
>   revision 1.1.1.2
>   date: 1995-02-27 11:49:43 +0100;  author: cgd;  state: Exp;  lines: +6
>   -6;
>   from Lite
>   ----------------------------
>   revision 1.1.1.1
>   date: 1993-03-21 10:45:37 +0100;  author: cgd;  state: Exp;  lines: +0
>   -0;
>   initial import of 386bsd-0.1 sources
>   ----------------------------
> and it's char * in 1.1.1.1 and 1.1.1.2 but ... in 1.1, so hell knows.
> 
> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@xxxxxxxxxxxxxxxxxx>

Patch applied.

Cheers,

Alex

> ---
>  man2/ioctl.2 | 52 ++++++++++++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 48 insertions(+), 4 deletions(-)
> 
> diff --git a/man2/ioctl.2 b/man2/ioctl.2
> index 6b55d47c9..d52f245c7 100644
> --- a/man2/ioctl.2
> +++ b/man2/ioctl.2
> @@ -20,9 +20,8 @@ .SH SYNOPSIS
>  .nf
>  .B #include <sys/ioctl.h>
>  .PP
> -.BI "int ioctl(int " fd ", unsigned long " request ", ...);"
> -.\" POSIX says 'request' is int, but glibc has the above
> -.\" See https://bugzilla.kernel.org/show_bug.cgi?id=42705
> +.BI "int ioctl(int " fd ", unsigned long " request ", ...);" "\fR  /* glibc, BSD */\fP"
> +.BI "int ioctl(int " fd ", int " request ", ...);" "\fR            /* musl, other UNIX */\fP"

[while applying, changed to use the \f[...] form.]

>  .fi
>  .SH DESCRIPTION
>  The
> @@ -103,7 +102,52 @@ .SH VERSIONS
>  .SH STANDARDS
>  None.
>  .SH HISTORY
> -Version\~7 AT&T UNIX.
> +Version\~7 AT&T UNIX has
> +.PD 0
> +.in +4n
> +.nf
> +.BI "ioctl(int " fildes ", int " request ", struct sgttyb *" argp );
> +.fi
> +.in
> +.PP
> +.PD
> +(where
> +.B struct sgttyb
> +has historically been used by
> +.BR stty (2)
> +and
> +.BR gtty(2),

[added a missing space while applying.]

> +and is polymorphic by request type (like a
> +.B void *
> +would be, if it had been available)).
> +.PP
> +SysIII documents
> +.I arg
> +without a type at all.
> +.PP
> +4.3BSD has
> +.PD 0
> +.in +4n
> +.nf
> +.BI "ioctl(int " d ", unsigned long " request ", char *" argp );
> +.fi
> +.in
> +.PP
> +.PD
> +(with
> +.B char *
> +similarly in for
> +.BR "void *" ).
> +.PP
> +SysVr4 has
> +.PD 0
> +.in +4n
> +.nf
> +.BI "int ioctl(int " fildes ", int " request ", ... /* " arg " */);"
> +.fi
> +.in
> +.PP
> +.PD
>  .SH NOTES
>  In order to use this call, one needs an open file descriptor.
>  Often the

-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux