4 ms·
About 20 or so years ago, I have come across a configuration pattern that could be arguably called "Level 0". It was configuration by file existence. The file
by susam 2y ago
About 20 or so years ago, I have come across a configuration pattern that could be arguably called "Level 0". It was configuration by file existence. The file itself would be typically empty. So no parsing, syntax, or schema involved. For example, if the file /opt/foo/foo.txt exists, the software does one thing but if it is missing the software does another thing. So effectively, the existence of the file serves as a boolean configuration flag.
- deleted 2y ago[deleted]
- umbra07 2y agoI use this approach for testing conditional logic in shell scripts sometimes.
- somat 2y agoA number of traditional unix utilities change their behavior based on what their name is. /bin/test and /bin/[ come to mind. but I just checked and a quick survey of openbsd finds. eject mt [ test chgrp chmod cksum md5 sha1 sha256 sha512 cpio pax tar ksh rksh sh taken to it's logical extreme you end up with somthing like crunchgen https://man.openbsd.org/crunchgen https://man.openbsd.org/crunchgen which merges many independent programs into one and select which one to run based on the name. And I am guilty of abusing symbolic links as a simple single value key value store. It turns out the link does not need to point to anything and using readlink(1) was easier than parsing a file.
- cduzz 2y agossh and rsh used to cause you to rsh/ssh to the name of the file... so I had, in my home directory ~me/bin/snoopy and if I wanted to log into snoopy, I'd just type $ snoopy and it'd rsh me into snoopy. Hilarity was the day when someone ran cd /export/home && for user in * ; do chown -R $user:users ; done (note the lack of the -h flag, which causes the ownership of the symbolic link instead of the reference of the symbolic link to be chowned)
- bangonkeyboard 2y agoA top-level /AppleInternal/ directory on macOS, even if empty, will enable certain features in Apple developer tools.
- LeifCarrotson 2y agoI've observed similar things to happen in other tools too - third-party tools that will list a certain set of file formats by default, and enable Autodesk formats if C:/Autodesk is present. It seems to be most common in systems that cross major business domains (or come from completely separate companies). If you could just add an entry to the featureful, versioned, controlled config file then you'd do that, but if you can't developers frequently resort to the "does this path name resolve" heuristic.
- ks2048 2y agoThis gives me an idea - store small integer parameters (<= 511) as file permissions (r/w/exe for user/group/other) on an empty file.
- rzzzt 2y agoLarger integers can go into UID:GID values.
- esafak 2y agoThat's just cramming a flag into the file system.
- deleted 2y ago
- noahjk 2y agoSimilar behavior in the s6 overlay framework for containers. Some files do things just by existing IIRC