<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body>
<div style="font-family:sans-serif"><div style="white-space:normal">
<p dir="auto">On 16 Jul 2019, at 21:09, Daniel Janus wrote:</p>
</div>
<div style="white-space:normal"><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><p dir="auto">Clearly, Busybox's `tr` doesn't support the `[:graph:]` character<br>
class. Instead, it's taking those 9 characters (8 distinct) as a<br>
character set.</p>
</blockquote></div>
<div style="white-space:normal">
<p dir="auto">This gave me a chuckle :)</p>
</div>
<div style="white-space:normal"><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><p dir="auto">Given that Busybox's focus is on size and essential features, and<br>
character classes are arguably not essential, I doubt whether this<br>
will be changed upstream.</p>
</blockquote></div>
<div style="white-space:normal">
<p dir="auto">I checked the source¹ and they have two commented constants: <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">CLASS_graph</code> and <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">CLASS_print</code>.</p>
<p dir="auto">I think that it’s just that nobody got around to adding support for these. It would hardly increase the size.</p>
<p dir="auto">Btw: Since they support both <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">alnum</code> and <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">punct</code>, I think you can use this:</p>
<pre style="background-color:#F7F7F7; border-radius:5px 5px 5px 5px; margin-left:15px; margin-right:15px; max-width:90vw; overflow-x:auto; padding:5px" bgcolor="#F7F7F7"><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0" bgcolor="#F7F7F7">read -r -n 12 pass < <(LC_ALL=C tr -dc '[:punct:][:alnum:]' < /dev/urandom); echo $pass
</code></pre>
<p dir="auto">Maybe submit a PR and see what Jason says.</p>
<p dir="auto">But I think it would be better to submit a PR toward BusyBox’s <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">tr</code> implementation.</p>
<p dir="auto">¹ <a href="https://git.busybox.net/busybox/tree/coreutils/tr.c" style="color:#3983C4">https://git.busybox.net/busybox/tree/coreutils/tr.c</a></p>
</div>
</div>
</body>
</html>