7 ms·
The first major release in 27 years. 64-bit internal structures, so data can be huge. Full unicode with all the funky new emojis. Zip filesystems, etc., etc.
by cmacleod4 2y ago
The first major release in 27 years. 64-bit internal structures, so data can be huge. Full unicode with all the funky new emojis. Zip filesystems, etc., etc.
There's lots of new stuff, and some old cruft has been dumped, so some programs may need a few updates, but there's still a high level of compatibility. The page above links to release notes with details of what's in and what's out.
- Zuider 2y agoWhy did they remove tilde '~' as a convenient shortcut for the Home directory?
- bch 2y agoTcl Improvement Proposal (TIP) 602[0]. [0] https://core.tcl-lang.org/tips/doc/trunk/tip/602.md https://core.tcl-lang.org/tips/doc/trunk/tip/602.md
- throw0101b 2y agoOne example from the document: > Consider the naive attempt to clean out the /tmp directory. > cd /tmp > foreach f [glob *] {file delete -force $f} > A file ~ or ~user maliciously placed in /tmp will have rather unfortunate consequences.
- amelius 2y agoIsn't that just tilde-expansion happening at the wrong moment?
- em-bee 2y agoi once managed to create a directory named ~ using the mirror tool written in perl. then i naively tried to remove it using "rm -r ~" and started wondering why removing an empty directory would take so long, until it dawned on me... i learned a few new habits since then. i almost never use rm -r and i avoid "*" as a glob by itself. instead i always try to qualify "*" with a path, remove files first: "rm dir/*"; and then remove the empty directory. "rmdir dir/" if i do want to use rm -r, it is with a long path. eg in order remove stuff in the current directory i may distinctly add a path: rm -r ../currentdir/*" instead of "rm -r *" related, i also usually run "rm -i", but most importantly, i disable any alias that makes "rm -i" the default, because in order to override the -i you need to use -f, but "rm -i -f" i NOT the same thing as "rm". rm has three levels of safety: "rm -i; rm; rm -f". if "rm -i" is the default the "rm" level gets disabled, because "rm -i -f" is the same as "rm -f"
- kristopolous 2y agoI've long fantasized about a tool I call "expect" that safeguards against crazy stuff like that. It has a syntax of your expectations, functionally existing as a set of boundaries, and you can hook it to always run as a wrapper for some set of commands. It essentially stages the wrapped command and if none of the boundaries are violated it goes through. Otherwise it yells at you and you need to manually override it. For instance, pretend I'm ok with mv being able to clobber except in some special directory, let's call it .bitcoin or whatever. (chattr can also solve this, it's just an example). The tool can be implemented relying on things like bpf or preload Originally I wanted it as a SQL directive ... a way to safeguard a query against doing like `update table set field=value expect rows=1` where you meant to put in the where clause but instead blew away an entire column. I think this would be especially useful surfacing it in frameworks and ORMs some of which make these accidents a bit too easy.
- danielheath 2y agoFor sql specifically, “limit 2” is my default way to write “expect 1”; if it affects two rows, I know that I have screwed up, whereas “limit 1” can be wrong without my noticing.
- kristopolous 2y agoThat's not a terrible solution although expect sounds like a simple safety mechanism for feeble-minded people like me who do simple queries. I actually know postgres people. I should probably ask them
- kragen 2y agojust to clarify, this has nothing to do with the "expect" that is the other major application of tcl other than tk?
- kristopolous 2y agoNone. I was just reminded of a good idea I never implemented
- AlienRobot 2y agoI once created a file named *. Sweats were sweated that day.
- orthoxerox 2y agoI've heard that one of the Unix founding fathers had a directory with 125 files that all had single-byte names: one for each ASCII symbol except slash, dot and null. He would then test any new utility against this directory and chew the careless programmer out if it couldn't correctly handle every one of these names.
- cmacleod4 2y agoIn the long run, special cases like that often turn out to be more trouble than they are worth. If an ordinary file happened to start with '~' it would not be handled correctly. So you either accept or ignore that potential problem, or you have to write extra code to work around it. It's safer to not have such special cases at all.
- mirekrusin 2y agoShould be starts with ~/
- cmacleod4 2y agoNo, ~abc will be interpreted as the home directory of user abc in Tcl 8.*
- eviks 2y agoThen you fix this mistake, not remove ~ completely
- Y_Y 2y agoIt's not a mistake
- mirekrusin 2y agoIf it's not a mistake then why they took it off?
- cmacleod4 2y agoThe original design decision was to behave like a shell, where ~ means your own home dir and ~fred means fred's home dir. With the benefit of experience, this is now seen to be unwise and a different decision has been made.
- Koshkin 2y agoJust recently I used '~' in the remote target path in the scp command, and, somewhat unexpectedly, it created the directory with that name and put the files there.
- isr 2y agoIn 99% of cases, yes - this is a pain in the backside. Long ago I adopted something from the plan9 way of doing things (when I was heavily using acme). Just symlink /h to /home. So ~user becomes /h/user, in places where ~ is not expanded for you.
- wduquette 2y agoThe Zip filesystem stuff is wonderful change to see: it takes a number of techniques that were common in the community (if you had the right tools and knew how to use them) for building standalone applications, and makes them part of the basic toolkit in a standard way. It's a truly excellent change, and I'm glad to see it.
- packetlost 2y agoCan you explain what zip filesystem is?
- mdaniel 2y agoA handler for treating .zip (and .jar and .tar ...) files as if they were a volume mounted at /home/user/foo.zip - e.g. https://github.com/openjdk/jdk/blob/jdk-21-ga/src/java.base/share/classes/java/net/JarURLConnection.java#L48 https://github.com/openjdk/jdk/blob/jdk-21-ga/src/java.base/... It may be easier to reason about when thinking of the way $(mount -o loop) works with .iso files -- a file that is a container for other files that one can mount as if it were a filesystem I was expecting pathlib in Python <https://docs.python.org/3/library/pathlib.html https://docs.python.org/3/library/pathlib.html> to have one since a lot of Python distributions ship the standard library in .zip files but evidently not. Python gonna Python in that way Firefox actually used to ship with that same "jar:" protocol handler, too, and I made good use of it for reading the javadoc html which was shipped inside zip files and was indescribably easier than trying to manage all the .html files in a Java 8 SDK distribution. They made heavy use of this because a lot of their internals were in .xpi formats (which is also a .zip file) but they recently dropped it because Firefox gonna Firefox^W double down on some random shit other than making a sane browser
- boltzmann-brain 2y agothey should do the same but for git repositories too
- formerly_proven 2y agoPython has something kinda like VFS support just as a very special case for importing stuff and reading associated data files, see Anchor ("mount point") and Traversable ("virtual Path") in https://docs.python.org/3.12/library/importlib.resources.abc.html https://docs.python.org/3.12/library/importlib.resources.abc... - the actual implementation is done in finders et al (https://docs.python.org/3.12/library/importlib.html#module-importlib.abc https://docs.python.org/3.12/library/importlib.html#module-i...)