Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.mac.system > #70055

Re: Finder copies folder when I try to open it. Why?

From Jolly Roger <jollyroger@pobox.com>
Newsgroups comp.sys.mac.system
Subject Re: Finder copies folder when I try to open it. Why?
Date 2015-02-21 15:29 +0000
Organization People for the Ethical Treatment of Pirates
Message-ID <ckrmisFl5d6U4@mid.individual.net> (permalink)
References (4 earlier) <0001HW.D10CDED50016CCEBB01029BF@news.astraweb.com> <ckpisfF5hnoU1@mid.individual.net> <0001HW.D10D2179001F47B7B01029BF@news.astraweb.com> <0001HW.D10D25A3002041A1B01029BF@news.astraweb.com> <1m07dna.fzr1lk1czvx85N%dempson@actrix.gen.nz>

Show all headers | View raw


On 2015-02-21, David Empson <dempson@actrix.gen.nz> wrote:
> Nelson <nelson@nowhere.com> wrote:
>
>> Well I used xattr to list and then delete the extended attribute:
>> 
>> com.apple.FinderInfo:
>> 00000000  00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00  
>> |................|
>> 00000010  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
>> |................|
>> 00000020
>> 
>> After I deleted it, the folder behaved normally.
>> 
>> Apparently Apple has removed the -c option from xattr so you have to 
>> know the name of the attribute you are removing and can't just delete
>> them whole-scale.
>> 
>> I wonder what that one bit is for.
>
> For a folder, the FinderInfo data structure is a struct FolderInfo (16
> bytes) followed by a struct ExtendedFolderInfo (16 bytes). The bit in
> question is in the first 16 bytes, so here is that part, from Finder.h:
>
> struct FolderInfo {
>   Rect                windowBounds;           /* The position and
> dimension of the folder's window */
>   UInt16              finderFlags;            /* ex. kIsInvisible,
> kNameLocked, etc.*/
>   Point               location;               /* Folder's location in
> the parent folder */
>                                               /* If set to {0, 0}, the
> Finder will place the item automatically */
>   UInt16              reservedField;          /* (set to 0) */
> };
>
> The Rect is the first 8 bytes, so the finderFlags field is 08 00. The
> FinderInfo is written in big-endian order (since it was that way dating
> all the way back to the original Mac Finder on the 68K family),
> therefore it is bit 11 which is set.
>
> According to the defintions in Finder.h, that bit is:
>
>   kIsStationery                 = 0x0800, /* Files only */
>
> (if it was actually the low order byte, that would be bit 3, which is
> part of part of kColor field).
>
> Therefore your folder really was flagged as being a stationery item, so
> Finder was obeying that flag (even though it is not valid for folders)
> and copying the folder when you tried to open it via AppleScript.

You can use the "mdls" command-line tool to list file metadata, which
includes the kMDItemFSIsStationery flag, if set:

# mdls eBay/
kMDItemContentCreationDate     = 2008-07-11 13:52:18 +0000
kMDItemContentModificationDate = 2008-07-11 13:52:18 +0000
kMDItemContentType             = "public.folder"
kMDItemContentTypeTree         = (
    "public.folder",
    "public.directory",
    "public.item"
)
kMDItemDateAdded               = 2011-10-08 15:04:30 +0000
kMDItemDisplayName             = "eBay"
kMDItemFSContentChangeDate     = 2008-07-11 13:52:18 +0000
kMDItemFSCreationDate          = 2008-07-11 13:52:18 +0000
kMDItemFSCreatorCode           = (null)
kMDItemFSFinderFlags           = 928
kMDItemFSHasCustomIcon         = (null)
kMDItemFSInvisible             = 0
kMDItemFSIsExtensionHidden     = 0
kMDItemFSIsStationery          = (null)
kMDItemFSLabel                 = 0
kMDItemFSName                  = "eBay"
kMDItemFSNodeCount             = 6
kMDItemFSOwnerGroupID          = 20
kMDItemFSOwnerUserID           = 502
kMDItemFSSize                  = (null)
kMDItemFSTypeCode              = ""
kMDItemKind                    = "Folder"

> How that flag got set is an interesting question. I wonder if any of the
> disk repair tools check for it and fix it.

It looks like you can toggle it for files with the /usr/bin/SetFile
command-line tool:

# SetFile 
Usage: SetFile [option...] file...
    -a attributes     # attributes (lowercase = 0, uppercase = 1)*
    -c creator        # file creator
    -d date           # creation date (mm/dd/[yy]yy [hh:mm[:ss] [AM |
PM]])*
    -m date           # modification date (mm/dd/[yy]yy [hh:mm[:ss] [AM
| PM]])*
	-P				  # perform action on symlink
instead of following it
    -t type           # file type

    Note: The following attributes may be used with the -a option:
        A   Alias file
        B   Bundle
        C   Custom icon*
        D   Desktop*
        E   Hidden extension*
        I   Inited*
        M   Shared (can run multiple times)
        N   No INIT resources
        L   Locked
        S   System (name locked)
        T   Stationery
        V   Invisible*
        Z   Busy*

    Note: Items marked with an asterisk (*) are allowed with folders
    Note: Period (.) represents the current date and time.
    Note: [yy]yy < 100 assumes 21st century, e.g. 20yy

Unfortunately, I just tried it on a folder without success...

Were the folders in question created quite a long time ago?

-- 
E-mail sent to this address may be devoured by my ravenous SPAM filter.
I often ignore posts from Google. Use a real news client instead.

JR

Back to comp.sys.mac.system | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Finder copies folder when I try to open it.  Why? Nelson <nelson@nowhere.com> - 2015-02-20 06:30 -0500
  Re: Finder copies folder when I try to open it.  Why? Jolly Roger <jollyroger@pobox.com> - 2015-02-20 12:49 +0000
    Re: Finder copies folder when I try to open it.  Why? Nelson <nelson@nowhere.com> - 2015-02-20 10:07 -0500
      Re: Finder copies folder when I try to open it.  Why? Barry Margolin <barmar@alum.mit.edu> - 2015-02-20 11:04 -0500
        Re: Finder copies folder when I try to open it.  Why? Nelson <nelson@nowhere.com> - 2015-02-20 11:58 -0500
      Re: Finder copies folder when I try to open it.  Why? Jolly Roger <jollyroger@pobox.com> - 2015-02-20 17:36 +0000
        Re: Finder copies folder when I try to open it.  Why? Nelson <nelson@nowhere.com> - 2015-02-20 12:53 -0500
          Re: Finder copies folder when I try to open it.  Why? Jolly Roger <jollyroger@pobox.com> - 2015-02-20 20:14 +0000
            Re: Finder copies folder when I try to open it.  Why? Nelson <nelson@nowhere.com> - 2015-02-20 17:38 -0500
              Re: Finder copies folder when I try to open it.  Why? Nelson <nelson@nowhere.com> - 2015-02-20 17:55 -0500
                Re: Finder copies folder when I try to open it.  Why? dempson@actrix.gen.nz (David Empson) - 2015-02-21 17:08 +1300
                Re: Finder copies folder when I try to open it.  Why? Jolly Roger <jollyroger@pobox.com> - 2015-02-21 15:29 +0000
                Re: Finder copies folder when I try to open it.  Why? Nelson <nelson@nowhere.com> - 2015-02-21 13:26 -0500
                Re: Finder copies folder when I try to open it.  Why? Jolly Roger <jollyroger@pobox.com> - 2015-02-21 20:35 +0000
                Re: Finder copies folder when I try to open it.  Why? Nelson <nelson@nowhere.com> - 2015-02-21 22:25 -0500
                Re: Finder copies folder when I try to open it.  Why? Jolly Roger <jollyroger@pobox.com> - 2015-02-22 15:43 +0000
              Re: Finder copies folder when I try to open it.  Why? Jolly Roger <jollyroger@pobox.com> - 2015-02-20 22:59 +0000
                Re: Finder copies folder when I try to open it.  Why? Nelson <nelson@nowhere.com> - 2015-02-20 18:47 -0500

csiph-web