taskThe GNU Hurd - Tasks: task #5724, is a node a directory or not

 
 

task #5724: is a node a directory or not

Submitter:  Thomas Schwinge <tschwinge>
Submitted:  Mon 17 Jul 2006 09:29:44 AM UTC
   
 
Category:  The GNU Hurd Should Start On:  Sun 16 Jul 2006 10:00:00 PM UTC
Should be Finished on:  Sun 16 Jul 2006 10:00:00 PM UTC Priority:  * 1 - Later
Status:  None Privacy:  Public
Assigned to:  None Percent Complete:  0%
Open/Closed:  Open Planned Release:  None
Effort:  0.00
Wiki-like text discussion box: 


* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 28 Aug 2016 04:11:30 PM UTC, comment #1: 

struct dirent has unsigned char d_type, whose value may be DT_DIR or something else.  But several file-system implementations on the Hurd always store DT_UNKNOWN there, regardless of what is on disk, so there should be no problem if a translator changes a file to a directory or vice versa.

  • ext2fs: DT_UNKNOWN since 1999-10-03.
  • fatfs: DT_UNKNOWN from the beginning.
  • ftpfs: Actual type, but netfs_set_translator returns EROFS.
  • isofs: DT_UNKNOWN from the beginning.
  • nfs: DT_UNKNOWN since 1996-03-19.
  • procfs: DT_UNKNOWN from the beginning.
  • tmpfs: DT_DIR for "." and "..", DT_UNKNOWN otherwise.


On 2003-01-21, a coreutils bug was fixed where rm would assume the entry is not a directory if d_type == DT_UNKNOWN.

It seems the implementation was already correct when this task was filed on 2006-07-17.  The IRC logs at http://richtlijn.be/~larstiq/hurd/ start from 2006-08-20 so I don't know what kind of problem was seen then.

Kalle Olavi Niemitalo <kon>
Mon 17 Jul 2006 09:29:44 AM UTC, original submission:  

02:36 <antrik> in standard POSIX, there is a way for applications to ask, "what kind of file object is this" I guess?
02:42 <marcus> well
02:42 <marcus> there are two ways you can get this information
02:43 <marcus> 1) the dirent of a directory entry has a "directory" bit that says if it is a directory or not
02:44 <marcus> 2) the stat information's mode field contains a file type, which is one of S_IFREG, S_IFIFO, S_IFLNK, S_IFDIR, S_IFCHR, S_IFBLK\, S_IFSOCK
02:44 <marcus> now, the problem in the current hurd is that the dirent entry always refers to the underlying node, never to the translated f\ile
02:44 <marcus> it is surprising we never noticed that to be a problem
02:45 <antrik> indeed
02:45 <marcus> I only noticed that when I tried to find out when my firmlink attack didn't work in some cases
02:45 <marcus> rm is actually looking at this field
02:45 <marcus> anyway, usually, the stat() field is looked at

Thomas Schwinge <tschwinge>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by kon (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code