From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <9front-bounces@9front.inri.net> X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: from 9front.inri.net (9front.inri.net [168.235.81.73]) by inbox.vuxu.org (Postfix) with ESMTP id EC70D24CA7 for ; Tue, 22 Oct 2024 11:08:24 +0200 (CEST) Received: from sirjofri.de ([5.45.105.127]) by 9front; Tue Oct 22 05:07:04 -0400 2024 Received: from dummy.faircode.eu ([31.16.254.19]) by sirjofri.de; Tue Oct 22 11:06:56 +0200 2024 Date: Tue, 22 Oct 2024 11:06:51 +0200 (GMT+02:00) From: sirjofri To: 9front@9front.org Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Correlation-ID: List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: package-based proxy engine interface Subject: [9front] 9pfile walkfile: is this a bug? Reply-To: 9front@9front.org Precedence: bulk Hi all, I'm in the middle of writing a filesystem and encountered some word behavior in 9pfile. That is, walkfile always decreases the reference counter for the filter to search from. walkfile(f, "name"); The reference counter for f will always be decreased using closefile. I found an incref in archfs, right before walkfile, but this whole situation makes me think if this is a bug or actually wanted behavior? I understand walkfile as a means to navigate the filesystem, not change it. I wouldn't understand why this would close the file. Does someone know more about this, maybe any reasoning? In any case, if that is wanted behavior it should be added to the man page, which currently only states that "reference counting is cumbersome". Regarding a potential man page change, the following sentence or something similar could be added to the walkfile section: > Walkfile also closes the directory dir. The user might want to use incref to control the reference counting. However, looking at the code of walkfile, if you supply a whole path to walkfile, it seems to close all of the path elements, maybe even multiple times when using paths like path/to/../to/../to/file. With that, I understand why it's "cumbersome"... Sorry for that weird unstructured mail. I hope you understand everything... sirjofri