From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by sourceware.org (Postfix) with ESMTPS id 32ACB385840D for ; Sat, 4 Sep 2021 19:44:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 32ACB385840D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-io1-xd35.google.com with SMTP id b10so3282268ioq.9 for ; Sat, 04 Sep 2021 12:44:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=OseQ0NkdVqi2V+5V+QXPYmSxj6VE8gUF2U5EKMEO4sM=; b=XT1iE6mo0YMUl+rjTCyljgpCz9v2NsoeeJj4zUaOOd7hhFiFvPOci3S+Tty7GHHK1k AQp6q2Sz6hNhRG0zio+r4ffHvDjNWhn+UI9QJC9svBuRodoikuqCCeT7QmU0fBAaq/xG 9HT5Hsx6gIO3zbu3p8Yva4XZ3yeg9JHq3GABHiW04iHsj71cx3/iWAZMOUiNeISdS37q YsgYRU7AIM4YADwhfLEXhrUss7sjuD0cGzDfg4Ohr/dd5snGT32eTthXsaZgQFzatM+C zCUwsnAikj1NIiv9mn3swZjLhZ+q8j0oYYMDFX95mBblpuKe5N9s/4EOz561+Oahd98R 9uTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=OseQ0NkdVqi2V+5V+QXPYmSxj6VE8gUF2U5EKMEO4sM=; b=sRQCuw4fE18VU9/Bp3A2sC1OxouVjONNm3DzGDX4PA2Chuu1xbpThfGNXwiyD5dXUx SH+aw6ScnnMoYVXbLhCtzqZ21sTXt94CNWZciaz1WWmXdoVehKoO1ggWjyPA7ZDsA9Nc 10effc6fno06GBy7BaV/xYNfckfnwsS9JtRqDdbxDrY41i78aROM9kfH9y/AKMdC6oua hkBQMf4TmbQRVkZ4bVIOTDBWqR0VQ6fdY9iMakvWdp7y5fcsR73T+c4QcMwd+xLaZLdo 2w/yxVDBd/rNftjiY9bIThcj9xYLas7E3YgULvqr8CEzf8uyWw4Td6ww7CQCwoIr5If0 N/jg== X-Gm-Message-State: AOAM530XCWYVfe79fF5fsmUabAQkTUbaPRB5gJFhJ98gkoIaQ6Y18fPz PWG2+h48o+6YlDpElt4sn10vj8pqyFFNXTu/cDqThzZ+1+3X2A== X-Google-Smtp-Source: ABdhPJx19yXOiXyztS72SNg9seN4VDmZQebi/p0Di3rpRzWCHfhEHlwUkclIYfJZo4iQhESayES3KyoeRc2eWcTOugU= X-Received: by 2002:a5e:c70c:: with SMTP id f12mr3973370iop.166.1630784678392; Sat, 04 Sep 2021 12:44:38 -0700 (PDT) MIME-Version: 1.0 From: =?UTF-8?Q?Th=C3=A9o_Beaudet?= Date: Sat, 4 Sep 2021 21:43:59 +0200 Message-ID: Subject: About making libc remove function POSIX-compliant To: newlib@sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Sep 2021 19:44:40 -0000 Hi This email is about the `int remove(const char *path)` function found in `stdio.h` not being correct according to the POSIX standard and thus breaking libstdc++ and libc++ (and possibly others, but I checked these two) C++17's std::filesystem::remove (and by extension std::filesystem::remove_all) function that rely on it, as it can only remove files and not directories. https://pubs.opengroup.org/onlinepubs/9699919799/functions/remove.html states that > If path does not name a directory, remove(path) shall be equivalent to un= link(path). > If path names a directory, remove(path) shall be equivalent to rmdir(path= ). Currently, the function `remove`/`_remove_r` found at `newlib / libc / stdio / remove.c` calls `_unlink_r`, and only that. I spent some time searching using the git web view on the sourceware.org website, and while `_unlink_r` is provided by `newlib / libc / reent / unlinkr.c` and depends on the libgloss library to be fully implemented (from what I see), there is no _rmdir_r equivalent. And so I wanted to ask this question: If it is desirable to be POSIX-compliant, where should this modification go? In newlib directly as a modification to `remove`, requiring a new function everywhere (namely `rmdir`) ? Or in libgloss as a change to the unlink implementation for platforms that want it? Finally, who would want to make this change? -- Thanks. Th=C3=A9o B.