GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Conversation

Notices

  1. Embed this notice
    Haelwenn /элвэн/ :triskell: (lanodan@queer.hacktivis.me)'s status on Wednesday, 15-Jan-2025 22:57:11 JST Haelwenn /элвэн/ :triskell: Haelwenn /элвэн/ :triskell:

    open(O_RDONLY | O_TRUNC)[…]
    What these flags specified together do is “undefined” in POSIX, but the Linux manpages ominously state “On many systems the file is actually truncated”, and indeed on Linux, using this open mode actually truncates files most of the time!

    — Haiku Activity & Contract Report, December 2024 (ft. Iceweasel)

    Holy shit, that sounds really bad.

    In conversation about a year ago from queer.hacktivis.me permalink
    • Embed this notice
      :umu: :umu: (a1ba@suya.place)'s status on Wednesday, 15-Jan-2025 23:03:02 JST :umu: :umu: :umu: :umu:
      in reply to
      @lanodan don't rely on undefined behavior, don't get undefined result.
      In conversation about a year ago permalink
      Haelwenn /элвэн/ :triskell: likes this.
    • Embed this notice
      Haelwenn /элвэн/ :triskell: (lanodan@queer.hacktivis.me)'s status on Wednesday, 15-Jan-2025 23:04:47 JST Haelwenn /элвэн/ :triskell: Haelwenn /элвэн/ :triskell:
      in reply to
      • :umu: :umu:
      @a1ba Yeah, I'd rather have it throw an error, which is what Haiku now does.
      In conversation about a year ago permalink
    • Embed this notice
      :umu: :umu: (a1ba@suya.place)'s status on Wednesday, 15-Jan-2025 23:04:48 JST :umu: :umu: :umu: :umu:
      in reply to
      • :umu: :umu:
      @lanodan though truncating file that's opened in readonly mode sounds evil.

      Even if it's undefined.
      In conversation about a year ago permalink
    • Embed this notice
      Haelwenn /элвэн/ :triskell: (lanodan@queer.hacktivis.me)'s status on Wednesday, 15-Jan-2025 23:08:30 JST Haelwenn /элвэн/ :triskell: Haelwenn /элвэн/ :triskell:
      in reply to
      • :umu: :umu:
      @a1ba And I guess if you want to be a bit spicy then an `abort()` could be used as it's a programmer error.
      Truncating with read-only mode… yikes.
      In conversation about a year ago permalink
    • Embed this notice
      Haelwenn /элвэн/ :triskell: (lanodan@queer.hacktivis.me)'s status on Wednesday, 15-Jan-2025 23:21:13 JST Haelwenn /элвэн/ :triskell: Haelwenn /элвэн/ :triskell:
      in reply to
      • :umu: :umu:
      @a1ba Well… it's one thing to write a bug, it's another to document it into the manpages.

      And as Linux isn't MacOS/illumos/OpenBSD, the libc isn't the only gateway into syscalls like open(2).
      In conversation about a year ago permalink
    • Embed this notice
      :umu: :umu: (a1ba@suya.place)'s status on Wednesday, 15-Jan-2025 23:21:14 JST :umu: :umu: :umu: :umu:
      in reply to
      @lanodan I wonder if it's just an oversight.

      I mean, imagine a VFS developer, who first check O_TRUNC flag, truncate it, and only then set desired mode for the file.

      Though, it's not a big deal if kernel is buggy, because libc wrapper could handle this and return error... or abort().
      In conversation about a year ago permalink
    • Embed this notice
      Haelwenn /элвэн/ :triskell: (lanodan@queer.hacktivis.me)'s status on Wednesday, 15-Jan-2025 23:33:39 JST Haelwenn /элвэн/ :triskell: Haelwenn /элвэн/ :triskell:
      in reply to
      • :umu: :umu:
      @a1ba Well yeah that section of POSIX just defines C interfaces, just happens that unix syscalls (which POSIX doesn't cares about) tends to exactly match some selected C interfaces.

      And just seems a lot better if not just correct to me to add a guard in the kernel, which is the one doing the truncation, rather than libc which just wraps and isn't the only wrapper.
      In conversation about a year ago permalink
    • Embed this notice
      :umu: :umu: (a1ba@suya.place)'s status on Wednesday, 15-Jan-2025 23:33:41 JST :umu: :umu: :umu: :umu:
      in reply to
      @lanodan it obvious that you can do raw syscalls but also in my opinion it's the libc who shall provide POSIX compatible interface rather than the kernel. Though it's only my opinion.
      In conversation about a year ago permalink

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.