Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Jolly Roger Newsgroups: comp.sys.mac.system Subject: Re: Finder copies folder when I try to open it. Why? Date: 21 Feb 2015 15:29:32 GMT Organization: People for the Ethical Treatment of Pirates Lines: 129 Message-ID: References: <0001HW.D10C84ED0003B1CEB01029BF@news.astraweb.com> <0001HW.D10CB7CD000DA8EAB01029BF@news.astraweb.com> <0001HW.D10CDED50016CCEBB01029BF@news.astraweb.com> <0001HW.D10D2179001F47B7B01029BF@news.astraweb.com> <0001HW.D10D25A3002041A1B01029BF@news.astraweb.com> <1m07dna.fzr1lk1czvx85N%dempson@actrix.gen.nz> X-Trace: individual.net PcAeU+WcsE6ANz89GpkUGwY6YPQID3prEn3SDU5Ka9sCkXKAuk Cancel-Lock: sha1:m5loJc7uCDVFpvhKB0fm0aZOtFU= X-Face: _.g>n!a$f3/H3jA]>9pN55*5<`}Tud57>1Y%b|b-Y~()~\t,LZ3e up1/bO{=-) User-Agent: slrn/1.0.1 (Darwin) Xref: csiph.com comp.sys.mac.system:70055 On 2015-02-21, David Empson wrote: > Nelson 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