posixutils-rs
posixutils-rs copied to clipboard
[uuencode, uudecode]: fix uuencode, uudecode and write their tests
Few changes have been done on uuencode.rs
The crate that was used i.e "uuencode", it seems that it outputs the permission symbols always as "644", which should be in fact the permission symbol of the file being "read", so i've removed the usage of uuencode from uencode.rs and implemented the historical encoding i.e the encoding used by uuencode as default(works well)
the algorithm for historical encoding is mentioned at : https://pubs.opengroup.org/onlinepubs/9699919799/utilities/uuencode.html
btw @jgarzik, do we plan on using spaces for the uuencode what i mean by that is, i was reading https://en.wikipedia.org/wiki/Uuencoding and https://news.ycombinator.com/item?id=38343748
what i found out was the encoder algorithm mentioned in the posixutils specification doesn't mention anything regarding SPACE and makes one use the ascii character at 32 i.e "SPACE" but the wikipedia and the thread mentions that some encoder uses the character ` instead of the SPACE so that,
so currently its upto us which one we choose, use the character ` instead of space or use the SPACE itself at the default ASCII position of 32
FYI: ` is preferred(and also most tools are implemented to replace SPACE with that character, including the official implementation at sharutils), the advantage of ` over SPACE is that it allows the string to be not truncated because of some tool
So, the question is do i use the default SPACE at the ascii position 32 or the character `
btw, both of them work, it's just the optimization towards real world use case
Postel's Law is the meta-answer: "the robustness principle is a design guideline for software that states: "be conservative in what you do, be liberal in what you accept from others". It is often reworded as: "be conservative in what you send, be liberal in what you accept".
uuencode should produce what is maximally likely to be accepted by the widest range of tools.
uudecode should accept what is "out there on the Internet" as existing UUE format.
hey @jgarzik, uuencode and uudecode are ready to be used now