[racket] DrRacket, OSX, and xattr

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Thu Jul 24 21:27:30 EDT 2014

I don't think that that's what's causing the overwrite/revert prompts.
There is definitely a bug there and I would love to know what's going
on, but DrRacket uses file-or-directory-modify-seconds to determine
whether or not to prompt, and setting this metadata doesn't change the
result of that function. Below is the test I used.

Robby

#lang racket/gui
(define fn "/Users/robby/x.rkt")
(call-with-output-file fn
  (λ (port) (write (random) port))
  #:exists 'truncate)
(define-values (_ type) (file-creator-and-type fn))
(list (file-or-directory-modify-seconds fn) (current-seconds))
(sleep 2)
(list (file-or-directory-modify-seconds fn) (current-seconds))
(file-creator-and-type fn #"DrSc" type)
(list (file-or-directory-modify-seconds fn) (current-seconds))



On Thu, Jul 24, 2014 at 6:45 PM, Spencer Florence
<florence at northwestern.edu> wrote:
> Two reasons:
>
> 1. DrRacket isn't always the default file association on my mac.
> 2. Something keeps butchering the xattrs (My guess is dropbox) so DrRacket
> keeps prompting me to overwrite the file on save and revert the file on run
> (more or less every time I do either). This is recent, but I'm not sure what
> changed. The only thing I remember updating recently is DrRacket, but who
> knows what is updating in the background.
>
> Either way it seems like xattrs causing overwrite/revert prompts is bad
> behavior, regardless if saving new xattrs is correct. It seems a bit like
> saying "the file was modified because you added the setuid bit... do you
> want to overwrite or revert?". The file wasn't modified, the file system
> metadata was.
>
>
>
> On Thu, Jul 24, 2014 at 6:25 PM, Robby Findler <robby at eecs.northwestern.edu>
> wrote:
>>
>> It is setting itself as the owner of the file so that subsequent
>> double-clicks on the file will open the file in DrRacket.
>>
>> This was the recommended behavior back in the day before you could
>> associate extensions with applications (I think).
>>
>> Why do you want to disable it?
>>
>> Robby
>>
>> On Thu, Jul 24, 2014 at 3:43 PM, Spencer Florence
>> <florence at northwestern.edu> wrote:
>> > Hi all,
>> >
>> > Whenever I save a file with DrRacket on OSX, it always sets some
>> > extended
>> > attributes on the file. Specifically it sets:
>> >
>> > [snips:pl7/examples] xattr -l somefile.rkt
>> > com.apple.FinderInfo:
>> > 00000000  54 45 58 54 44 72 53 63 00 00 00 00 00 00 00 00
>> > |TEXTDrSc........|
>> > 00000010  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> > |................|
>> > 00000020
>> >
>> > In addition if I clear the xattr's (via xattr -c) DrRacket treats this
>> > as an
>> > external write to the file and prompts me to overwrite on save and
>> > revert on
>> > run. Is this behavior intended? It seems odd given that DrRacket doesn't
>> > do
>> > this with normal attributes (permission, suid bit, etc.) If it is
>> > intended
>> > what is the rational and can I disable it?
>> >
>> > --Spencer
>> >
>> >
>> >
>> > ____________________
>> >   Racket Users list:
>> >   http://lists.racket-lang.org/users
>> >
>> ____________________
>>   Racket Users list:
>>   http://lists.racket-lang.org/users
>
>
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>


Posted on the users mailing list.