[lug] What was I thinking?
Scott Jackson
scott.jackson.swe at gmail.com
Wed Aug 13 21:02:39 MDT 2014
If you are supporting code 20 years old, then you need to hide your tracks better!
Sent from my iPhone
> On Aug 13, 2014, at 6:18 PM, "Jeffrey S. Haemer" <jeffrey.haemer at gmail.com> wrote:
>
> No good deed goes unpunished.
>
> 20 years ago, I wrote a tool that triggered actions based on file changes. Tom Schneider, a friend at the NIH, had written an first version as a csh script, which I re-wrote for him in Perl, and generalized into a little, domain-specific-language. It was a useful and fun exercise.
>
> In brief, the tool -- atchange -- is an infinite loop, watching for file modifications, executing the actions when the mtime changes.
>
> Yesterday, Tom sent me a note asking why it had stopped working: when he deletes messages from his mailbox, it fails to notify him that the mailbox has changed.
>
> This morning, he sent me a copy of the program -- changed some since I last saw it, but still comprehensible -- and enough code to be able to reproduce his problem.
>
> Running his test required installing tcsh and mutt, but okay, fine. My goal is to help him, not to suggest that he change the way he works or the tools he uses. He's an involuntary immigrant from another era, and a scientist, not a programmer. Tom also still programs in Pascal.
>
> Once I did, though, I could reproduce the problem.
>
> By fishing through the code, narrowing things down, and doing experiments, I discovered that when you bring up a mailbox in mutt, delete some messages, and exit, the messages are removed from the mailbox but the mtime is unchanged. Mutt actually appears to cache the mtime, modify the file (leaving it with the same inode number), and then reset the mtime to what it started out as. And no, mail(1) doesn't even do this. It's probably a feature.
>
> So, like, when I wrote atchange, I probably just assumed that when a file is modified, the modification time changes.
>
> What was I thinking? :-)
>
> --
> Jeffrey Haemer <jeffrey.haemer at gmail.com>
> 720-837-8908 [cell], http://seejeffrun.blogspot.com [blog],
> http://www.youtube.com/user/goyishekop [vlog]
> פרייהייט? דאס איז יאַנג דינען וואָרט.
> _______________________________________________
> Web Page: http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20140813/3118b6a0/attachment.html>
More information about the LUG
mailing list