[Cuis-dev] FileEntry fileContents hangs on macOS Alias file

Bernhard Pieber bernhard at pieber.com
Wed Aug 13 13:09:43 PDT 2025


Hi Juan,

It gets even weirder. While binaryContents size for bad answers 0:
(DirectoryEntry userBaseDirectory / 'alias_test' // 'good') binaryContents size.  1228 .
(DirectoryEntry userBaseDirectory / 'alias_test' // 'bad') binaryContents size. 0 .

… fileSize answers 128:
(DirectoryEntry userBaseDirectory / 'alias_test' // 'good') fileSize. 1228 .
(DirectoryEntry userBaseDirectory / 'alias_test' // 'bad') fileSize. 128 .

In Squeak fileSize answers the correct size:
((FileDirectory forFileName: '/Users/bernhard/Entwicklung/Cuis/Cuis-Smalltalk/Cuis-Smalltalk-Dev-UserFiles/alias_test/') entryAt: 'bad') fileSize. 1172 

The primitive in Cuis also answers the correct size:
FileIOAccessor default primFixedNameLookupEntryIn: '/Users/bernhard/Entwicklung/Cuis/Cuis-Smalltalk/Cuis-Smalltalk-Dev-UserFiles/alias_test/' asUtf8Bytes index: 1. #('bad' 3931592513 3931592513 false 1172) .

However, FileIOAccessor>>#fileSize: does not use it.

Cheers,
Bernhard


> Am 13.08.2025 um 21:22 schrieb Bernhard Pieber via Cuis-dev <cuis-dev at lists.cuis.st>:
> 
> Hi Juan,
> 
> Thanks for looking into this. This is really strange.
> 
> I redownloaded the attachment alias_test.zip from my mail to Cuis-Smalltalk-Dev-UserFiles by dragging it in the Finder. I double-clicked it to decompress it to the folder alias_test.
> 
> I get this:
> (DirectoryEntry userBaseDirectory / 'alias_test' // 'good') binaryContents size. 1228 .
> (DirectoryEntry userBaseDirectory / 'alias_test' // 'bad') binaryContents size. 0 .
> 
> … even though the file named bad has 1172 bytes:
> bernhard at Mini64 Cuis-Smalltalk-Dev-UserFiles % ls -lT alias_test
> total 16
> -rw-r--r--@ 1 bernhard  staff  1172  2 Aug 13:01:53 2025 bad
> -rw-r--r--@ 1 bernhard  staff  1228  2 Aug 12:42:50 2025 good
> 
> Here is the hash:
> bernhard at Mini64 Cuis-Smalltalk-Dev-UserFiles % md5 alias_test/bad
> MD5 (alias_test/bad) = 0e43b79da6ba19d176a1f02e6147fb77
> 
> bernhard at Mini64 Cuis-Smalltalk-Dev-UserFiles % hexdump -C alias_test/bad
> 00000000  62 6f 6f 6b 00 00 00 00  6d 61 72 6b 00 00 00 00  |book....mark....|
> 00000010  38 00 00 00 38 00 00 00  5c 04 00 00 00 00 04 10  |8...8...\.......|
> 00000020  00 00 00 00 01 00 00 00  9e b5 97 d0 13 1f c7 41  |...............A|
> ...
> 00000460  00 00 00 00 01 d0 00 00  38 02 00 00 00 00 00 00  |........8.......|
> 00000470  10 d0 00 00 04 00 00 00  00 00 00 00 17 f0 00 00  |................|
> 00000480  f8 00 00 00 00 00 00 00  22 f0 00 00 04 03 00 00  |........".......|
> 00000490  00 00 00 00                                       |....|
> 00000494
> 
> I want to read those bytes in Cuis.
> 
> What do you get if you do this?
> (DirectoryEntry userBaseDirectory / 'alias_test' // 'bad') binaryContents size.
> 
> Do you get a different hash?
> 
> Cheers,
> Bernhard
> 
> 
>> Am 13.08.2025 um 20:22 schrieb Juan Vuletich <juan at cuis.st>:
>> 
>> Hi Bernhard,
>> 
>> On 05/08/2025 6:15 PM, Bernhard Pieber via Cuis-dev wrote:
>>> Hi,
>>> 
>>> I tripped over a macOS alias file which has only 1172 bytes but whose contents cannot be shown in a file list in the latest Cuis7.5-7384.image. The cursor turns into an hourglass and I need to interrupt Cuis with Cmd-Dot.
>>> 
>>> I attached a zipped directory with the bad file and a good alias file to compare. To reproduce do:
>>> 
>>> (DirectoryEntry userBaseDirectory / 'alias_test' // 'good') fileContents size. 1222 .
>>> (DirectoryEntry userBaseDirectory / 'alias_test' // 'bad') fileContents size. „hangs"
>>> 
>>> Is this a bug or a feature?
>>> 
>>> If I use binaryContents it does not hang but answers a size of 0 which also seems false to me as the file contains 1172 bytes. How can I get those into a ByteArray?
>>> 
>>> (DirectoryEntry userBaseDirectory / 'alias_test' // 'good') binaryContents size. 1228 .
>>> (DirectoryEntry userBaseDirectory / 'alias_test' // 'bad') binaryContents size. 0.
>>> 
>>> I could reproduce it on another Mac.
>>> 
>>> Cheers,
>>> Bernhard
>> 
>> 
>> I unzipped your file on my Mac and tried. If I open Mac Finder on the
>> folder, and ask for 'Get Info' on them, I get:
>> 
>> 'good'. Kind: Document. Size: 1228 bytes.
>> 
>> 'bad'. Kind: Alias. Size: 1172 btytes. Original:
>> /Users/bernhard/Dropbox/......./....rtfd
>> 
>> So, the 'good' is a regular file, not an alias. 'bad' is an alias, and
>> the original file is not available in my system (making it a broken alias).
>> 
>> I don't see any crash, but trying to open 'bad'(with #fileContents or
>> #binaryContents) results in a "bad does not exist" message. If I create
>> an alias to a file that does exist, I get the contents of the file, even
>> when if I open Terminal and do `more aliasAjuan1.txt` I get the binary
>> encoding of the alias, and not the contents of the referenced file
>> ('juan1.txt').
>> 
>> So, if there is a problem in your system, I could not reproduce it. What
>> I see looks quite reasonable for me.
>> 
>> HTH,
>> 
>> --
>> Juan Vuletich
>> www.cuis.st
>> github.com/jvuletich
>> researchgate.net/profile/Juan-Vuletich
>> independent.academia.edu/JuanVuletich
>> patents.justia.com/inventor/juan-manuel-vuletich
>> 
> 
> 
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev




More information about the Cuis-dev mailing list