The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] 30 days of awktober
@ 2024-10-05 19:44 Rich Salz
  2024-10-05 22:23 ` [TUHS] " Steffen Nurpmeso
  0 siblings, 1 reply; 2+ messages in thread
From: Rich Salz @ 2024-10-05 19:44 UTC (permalink / raw)
  To: The Eunuchs Hysterical Society

[-- Attachment #1: Type: text/plain, Size: 161 bytes --]

Someone is trying to write something interesting about awk every day of
this month.  The thread starts here:
https://mastodon.mit.edu/@eichin/113240121988228925

[-- Attachment #2: Type: text/html, Size: 276 bytes --]

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

* [TUHS] Re: 30 days of awktober
  2024-10-05 19:44 [TUHS] 30 days of awktober Rich Salz
@ 2024-10-05 22:23 ` Steffen Nurpmeso
  0 siblings, 0 replies; 2+ messages in thread
From: Steffen Nurpmeso @ 2024-10-05 22:23 UTC (permalink / raw)
  To: Rich Salz; +Cc: The Eunuchs Hysterical Society

Rich Salz wrote in
 <CAFH29tptJ87d9LbR3DUj1meCaRKn8J6eY0GtBF51xGMnRbkp9w@mail.gmail.com>:
 |Someone is trying to write something interesting about awk every day of
 |this month.  The thread starts here:
 |https://mastodon.mit.edu/@eichin/113240121988228925

The good thing is that find(1) now has + standardized.  Ie his

  find /tmp --print0 | xargs -0 stat --format "%s %n"

can now be

  find /tmp -exec stat --format "%s %n" {} +

And the POSIX core developers mention (APPLICATION USAGE)

  It should be noted that using find with −print0 to pipe input to
  xargs −r0 is less safe than using find with −exec because if
  find −print0 is terminated after it has written a partial
  pathname, the partial pathname may be processed as if it was
  a complete pathname.

Heh!

Other than that, off-topic to this thread i am afraid, but should
be posted to another, .. but now that i am here, you know, we all
owe thanks to Geoff Clare and Andrey Josey (and Eric Blake of
RedHat, but really, the Linux approach to this problem makes me
sick, it really should have to work as shown in RFC 2553->3493),
as only thanks to these people the BSD socket API is still
compatible with ISO C .. at least on POSIX systems!

And here is how:

  In stating these field mapping requirements when a cast operator
  is applied to the various socket address structures, the
  standard defines the behavior in circumstances where the
  behavior is undefined in the ISO C standard. The onus is on
  implementations to ensure that these mappings are as described
  in the standard, making use of implementation-specific
  extensions if necessary, even though this is not stated
  explicitly.

and the solution is

  On page 386 line 13115 section <sys/socket.h> DESCRIPTION, change:

      When a pointer to a sockaddr_storage structure is cast as
      a pointer to a sockaddr structure, the ss_family field of
      the sockaddr_storage structure shall map onto the sa_family
      field of the sockaddr structure. When a pointer to
      a sockaddr_storage structure is cast as a pointer to
      a protocol-specific address structure, the ss_family field
      shall map onto a field of that structure that is of type
      sa_family_t and that identifies the protocol’s address
      family.

  to:

      When a pointer to a sockaddr_storage structure is cast as
      a pointer to a sockaddr structure, or vice versa, the
      ss_family field of the sockaddr_storage structure shall map
      onto the sa_family field of the sockaddr structure. When
      a pointer to a sockaddr_storage structure is cast as
      a pointer to a protocol-specific address structure, or vice
      versa, the ss_family field shall map onto a field of that
      structure that is of type sa_family_t and that identifies
      the protocol’s address family. When a pointer to a sockaddr
      structure is cast as a pointer to a protocol-specific
      address structure, or vice versa, the sa_family field shall
      map onto a field of that structure that is of type
      sa_family_t and that identifies the protocol’s address
      family. Additionally, the structures shall be defined in
      such a way that the compiler treats an access to the stored
      value of the sa_family_t member of any of these structures,
      via an lvalue expression whose type involves any other one
      of these structures, as permissible, despite the more
      restrictive expression rules on stored value access as
      stated in the ISO C standard.

as well as this RATIONALE addition:

  Note that defining the sockaddr_storage and sockaddr structures
  using only mechanisms defined in early editions of the ISO
  C standard may produce aliasing diagnostics when applications
  use casting between pointers to the various socket address
  structures. Because of the large body of existing code utilizing
  sockets in a way that could trigger undefined behavior due to
  strict aliasing rules, this standard mandates that these
  structures can alias each other for accessing the sa_family_t
  member of the structures, so as to preserve well-defined
  semantics. An implementation's header files may need to use
  anonymous unions, or even an implementation-specific extension,
  to comply with the requirements of this standard.

I love this standard.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

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

end of thread, other threads:[~2024-10-05 22:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-05 19:44 [TUHS] 30 days of awktober Rich Salz
2024-10-05 22:23 ` [TUHS] " Steffen Nurpmeso

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 NNTP newsgroup(s).