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

 
 

task #5724: is a node a directory or not

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

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project Administrator

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    No Changes Have Been Made to This Item

    Back to the top


    Powered by Savane 3.1-cleanup