
LKML: New syscall: leftpad() - ajdlinux
https://lkml.org/lkml/2016/3/31/1108
======
mchahn
This is the second april fool's post. I dread the next 24 hours.

~~~
whitenoice
I hope tesla's model 3 is not april fool's!

------
tptacek
Please don't start this. April 1 is extremely tedious.

~~~
sergiotapia
Stay offline. It's fun for us.

------
DblPlusUngood
As a longtime OpenBSD misc reader, it took me a few minutes before I became
convinced that the OP was joking.

------
sergiotapia
And just like that left-pad.io is cut out of the market. Man, startups are
cutthroat these days, but that's business for you.

~~~
qopp
Actually this is an opportunity for left-pad.io. Previously they had to
maintain custom code, but now they can interface through to the kernel which
is much faster and allows them to scale.

Many people are on older kernels and might not be able to upgrade, or for
convenience or other reasons simply prefer to use an api for their critical
business logic.

~~~
JetSpiegel
They can compile a unikernel with this single function, even.

------
jordanb
Wow, this blows left-pad.io's whole business model. Wonder what they're going
to use their VC millions on now?

EDIT: Here's an idea: Monetize your padding by putting ads in it.

~~~
Russell91
Pivot to right-pad.io

~~~
Philadelphia
I propose center padding. Why does the padding need to be at the end of the
word? That's just an artificial limitation imposed by the rent-seeking
incumbents in the padding industry.

~~~
spbaar
Middle out padding. It just might work

------
shruubi
[https://lkml.org/lkml/2016/3/31/1125](https://lkml.org/lkml/2016/3/31/1125)

Somehow, this just makes it better...

------
0xcde4c3db
> As everyone knows, within the kernel everything is faster and better.

> Leftpad has millions of users, so it has to be as fast as possible.

Flawless logic.

------
kbenson
Is it too much to hope for Linus to either wholeheartedly endorse this patch,
or (preferably) eviscerate it for not being implemented well in some way? That
would really be the icing on the cake.

~~~
Bytes
Since this is such an important system call, I am sure we will see it in the
kernel in the next release.

------
pmalynin
Let's see how far we can ride this joke. I see next step as being an ASIC for
leftpad.

Hardware accelerated leftpad anyone?

~~~
microcolonel

        PADL AL, 1h

~~~
0xcde4c3db
People who have never looked at golfed x86 assembly language probably don't
realize how close this is to reality.

[https://reverseengineering.stackexchange.com/questions/2774/...](https://reverseengineering.stackexchange.com/questions/2774/what-
does-the-assembly-instruction-repne-scas-byte-ptr-esedi/2775)

~~~
pmalynin
Well that's what you get when instructions can be up to 14 bytes in length

~~~
amluto
15 bytes. Sheesh :)

------
ndesaulniers
For context ioctl is considered this ridiculous grab bag of a syscall that
people overload (abuse) rather than add new syscalls. Used a lot for a lot of
things, but the literature doesn't speak highly of it.

~~~
cbd1984
For more context:

ioctl means "We made this object's API file-like, but there's something we
need to do with this object which we can't express in terms of the normal file
operations."

Setting terminal options is a classic use of ioctls: You have a file
descriptor which connects to a terminal or, more likely, a pseudo-terminal,
and now you need to ask the user on that terminal for a password. By default,
the low-level code will echo every character back to the user, so they can see
what they just typed, but that's insecure for passwords, so you need an ioctl
to tell the low-level terminal handling code to not echo.

Plan 9 removed some of these warts, but it's hard to see a fully, truly
elegant way to handle something which is mostly-file-like but has some un-
file-like attributes programs need to frob.

------
bazfoo
While the joke is relatively amusing, it would be better to seem more useful
solutions contributed to the ecosystem like depscheck [1] for Go.

[1]: [https://github.com/divan/depscheck](https://github.com/divan/depscheck)

------
polemic
If this had a buffer overflow vulnerability it'd be perfect ;0

~~~
barsonme
Left-pads your entire hard drive*

* Or until the kernel revokes your programming license.

------
mayank
left-pad.io was shortsighted from the start, everybody knew that, but nobody
in the echo chamber wanted to admit it. Now that left-pad.io's unicorn chances
are all but smashed, perhaps we can look forward to SF rents finally coming
down!

------
swang
_Days since a stupid leftpad joke_

0

------
zem
seldom have I seen april fools day won this early!

~~~
jacques_chester
It's been going for quite a few hours at this point.

------
rev_null
This is doesn't help all of the JavaScript developers on OS X.

------
Bytes
This really makes node a first class citizen of linux. I am sure moving node
modules to the kernel will greatly increase their speed. :)

------
cant_kant
I propose that facebook() be put into the public kernel

For the secret* kernel that is known only to us, facebook () should be
replaced by hn().

------
wolf550e
for anyone unaware: look at the date.

~~~
melvinmt
What's on March 31st?

~~~
marvy
April 1 for some time zones

------
shiftoutbox
What was that random comment about how Linux dosn't break userland Abi . Was
this a early April l fools joke ?

~~~
whoosher
Whoosh!

~~~
Syrup-tan
[https://xkcd.com/1627/](https://xkcd.com/1627/)

I think you added an "H"

~~~
cbd1984
The "whoosh" spelling is older than xkcd.

------
jimmeyotoole
This is actually amazing :D

------
fotcorn
And so it begins :)

------
waynecochran
We need an orthogonal `rightPad()` as well to be complete.

~~~
13of40
No, silly, you just reverse the string, leftPad, and reverse the string again.

------
arquinox
1 APRIL 2016 00:33.... 'nuff said people.

------
wrong_variable
I hate to spoil the fun for everyone.

But there is actual value in doing things the npm/unix way.

Just yesterday I used a module to turn numbers to comma separated strings
10000 -> 10,000

Could I have written a function to do it ?

Sure

But every less line of code I need to write saves me time.

Programming is fundamentally a creative field ( which means there is no
absolute truths ) - and each individual developer should be given the freedom
judge when to write code and when to use other's people modules.

I would say that this whole fiasco just proves how awesome programming has
become - remember the days when adding a dependency was hell ? Now we live in
a world where adding dependency has so little cost that we rather not even
spend 10 minutes writing a function.

To me its an improvement over the state of affairs from the past.

Its also cheaper to switch dependencies - imagine if the leftpad disaster was
somewhere in the window's kernel ? or in std:: ?

There is always trade-offs in every decision you make in software - I think we
are moving in the right direction.

Just need to make package creation immutable.

~~~
DannyBee
"But there is actual value in doing things the npm/unix way."

This is where the node community falls down. They think because there is value
in _sometimes_ doing it this way, there is _always_ value in doing it this
way.

Rarely is the right answer for architecture/programming/etc at one of the
extremes.

~~~
pcwalton
The left-pad debacle is not an indictment of small dependencies. The problem
would have still happened even if left-pad were a 10,000-line dependency, if
that 10,000-line left-pad was as popular as the 10-line left-pad was.

The issue was that authors in the npm ecosystem could pull their packages and
cause havoc. Copying code is a partial workaround for this problem for small
dependencies only, but the problem should be solved at the npm level--and once
it's solved there, the virtues of copying code go away.

~~~
DannyBee
I don't buy your argument that "the virtues of copying code go away" in any
way, shape or form. It seems somewhat arrogant to me to think that people have
spend decades on software engineering approaches to these kinds of issues, but
y'all think "yeah, we solved that, no problem!". But I'm not going to argue
this further. I guess time will tell.

~~~
pcwalton
This doesn't seem responsive to my argument at all.

I'm speaking from experience with a package manager that was specifically
designed up front to avoid the left-pad issue (before left-pad even was a
thing). In that environment, dependencies, even small ones, are great. With an
overrides feature and lockfiles, you get all the benefit of copying code
(ability to hack on it, responsibility for updates, reproducible builds)
without the hassles of copying code and trying to stay in sync with upstream.

Copying code isn't something you have to spend decades to invent. Rather, I
see it as giving up on proper package management. There are coherent arguments
that package managers aren't worth it (though I disagree with them), but I
don't agree that it's arrogant to try to build package managers that scale up
and down, any more than any attempt to use software to solve an engineering
problem is arrogant.

