19

This answer does not work on the FreeBSD system I use. However I think it was written on a Linux system, since FreeBSD xargs does not offer the -l switch (deprecated, by the way).

Actually I tested the provided command line on tutorialspoint and it doesn't even work. Besides the -l switch that I replaced with -L1, there are other issues related to handling of spaces.

I did some testing and I found a working command line that is supposed to work on Linux as well.

Should I:

  • edit the answer explaining that the first example does not work on BSD and adding mine (after all I got the idea from that answer)?
  • just replace the command line with mine?
  • add my own answer referencing the "wrong" one?
10
  • You can edit it, if you know what are you doing. Related meta.stackoverflow.com/a/316531/792066 and meta.stackoverflow.com/a/316832/792066
    – Braiam
    Commented Jan 1, 2017 at 13:47
  • 6
    @Braiam You can, but you shouldn't touch anyone's code!
    – Maroun
    Commented Jan 1, 2017 at 13:47
  • 2
    @MarounMaroun What pile of rubbish! If you are an knowledgeable user and improve someone post, why you shouldn't improve it?
    – Braiam
    Commented Jan 1, 2017 at 13:50
  • 8
    @Braiam Actually your comment is on the top of pile of all piles of rubbish. There are 100000 posts on meta that tells you NOT TO MODIFY code of others in answers. Please go through them before you argue.
    – Maroun
    Commented Jan 1, 2017 at 13:52
  • 1
    @MarounMaroun IT IS NOT CODE! It's a command of a tool. And we at the *NIX community heavily favors such thing.
    – Braiam
    Commented Jan 1, 2017 at 13:57
  • BTW, what OlafM describe has already happened before (someone updated the answer to replace a depreciated flag with current one) and the SO community favors those changes too, so I went ahead and edited the answer.
    – Braiam
    Commented Jan 1, 2017 at 14:02
  • 10
    @MarounMaroun "There are 100000 posts on meta that tells you NOT TO MODIFY code of others in answers." - there are certainly some, but they represent a fringe view, not the overall consensus of the community. The closest thing we have to authoritative guidelines on this (albeit controversial ones that I don't agree with in their entirety) is the When should I make edits to code? FAQ entry, which makes explicit that some code edits are good.
    – Mark Amery
    Commented Jan 1, 2017 at 21:05
  • 4
    A second reason why this command won't work on FreeBSD is that it doesn't have md5sum command in the base system. The command on FreeBSD is md5. Crafting shell commands that work well on all common Unix-y systems is still a pain :-/ Commented Jan 2, 2017 at 8:55
  • @MarounMaroun I think you're crossing code edits in questions and in answers, we should not edit code in questions, as it could be the root cause of the problem, but I see no reason to not update an answer nor to make it more portable if possible. Answer author will be notified and is still free to roll-back if he/she disagree with the edit.
    – Tensibai
    Commented Jan 3, 2017 at 13:52
  • And FWIW, for those over 10K, see the last deleted answer, deleted because this answer won't work anyway per the (wise IMHO) comment under it.
    – Tensibai
    Commented Jan 3, 2017 at 14:00

3 Answers 3

11

If you can improve someone's answer, replacing arguments which are deprecated with current ones, you are invited to do so. The help center squarely says "If you see something that needs improvement, click edit!". What needs improvement more than an argument that was deprecated and should be replaced with a more recent one? So, the help center suggests you edit the answer and update the command:

To correct minor mistakes or add updates as the post ages

What you describe happened before, someone amended someone else's command to replace a deprecated argument with one more recent and the community strongly felt that that's what edits are for.

Recommended read:

8
  • 1
    ok, but only on old answers. New answers should be commented upon / downvoted if they don't work. Commented Jan 1, 2017 at 20:36
  • 2
  • 5
    of course, if it's just a typo, I'd edit it. But if it's to fix the answer because it has always been broken, like unfixable, then downvote, and move on / post your own :) Commented Jan 1, 2017 at 21:21
  • @Jean-FrançoisFabre what about the current case? Changing a parameter which is being depreciated with the newer one? Like -loop_input with -loop 1? Or with one more general like POSIX's (which is the one OP is talking about)?
    – Braiam
    Commented Jan 2, 2017 at 17:57
  • There's no definitive answer I suppose. If the "old' answer is very good, well, maybe but I'd prefer leaving a comment to the poster first if still active (check poster activity) so he/she can fix it him/herself. And if it's not the case, fix it. If the answer is average, why not posting an updated & better one? Noone will downvote you for doing that. Commented Jan 2, 2017 at 19:44
  • @Jean-FrançoisFabre Why do you treat "old" different than "new"? SO rarely cares about how old information is, as the default ordering is by votes or "how useful it is". I don't see why plain good "improve it if you can" isn't applicable.
    – Braiam
    Commented Jan 2, 2017 at 20:22
  • 2
    I hope people won't start to edit answers after this post.. I really hope so...
    – Maroun
    Commented Jan 3, 2017 at 12:31
  • 2
    @MarounMaroun I hope people improve the quality of the site after this post... I really hope so...
    – Braiam
    Commented Jan 3, 2017 at 13:13
2

Should I edit the answer explaining that the first example does not work on BSD and adding mine

Absolutely no. We should never make code-edits to answers. You can drop a BTW-comment that explains what modifications need to be done in order to make it work on BSD.

I don't see someone is complaining about BSD issue, I'm not sure if it's really needed to add a new answer for that specific case. Anyhow, if your explanation doesn't fit into a comment, and you insist to add an answer, post a new one and don't edit the existing post.


EDIT

Answers can have upvotes, and edits can be wrong and can mislead users. I'm really against making edits like (example):

BTW, this command doesn't work on Ubuntu, try XXX instead to make it work

on posts that were targeting Fedora users. Adding it as a comment will both protect the answer and be helpful for other (remember that comments are part of the answer).

On the other hand, if there's a clear typo, and I'm 100% sure about what I'm doing, I allow myself to do edits like (example):

str.stringSet("hello"); str.setString("hello");

the strike in just to demonstrate the edit in this answer, not in real edits.

23
  • 10
    This is pure rubbish! The help center says "If you see something that needs improvement, click edit!" Why wouldn't someone edit an answer so it works on more systems?
    – Braiam
    Commented Jan 1, 2017 at 13:46
  • there are quite some answers from old post around that were edited, but usually, those edits only add contents, warning, deprecation, version, better alternative... they don't remove.
    – Walfrat
    Commented Jan 1, 2017 at 13:53
  • 8
    @Braiam I really, really hope no one make such edits for answers, otherwise the use should be banned from editing.
    – Maroun
    Commented Jan 1, 2017 at 13:57
  • 4
    @OlafM Don't! This kind of edits get rejected, and shouldn't be done at all. As I suggested, dropping a comment for OP would be a much better idea.
    – Maroun
    Commented Jan 1, 2017 at 14:04
  • 3
    @MarounMaroun stop recommending such counterproductive behavior. Shog himself told people not to act of stuff they do not know of: skip it because I don't know the subject well enough to know it's an improvement.
    – Braiam
    Commented Jan 1, 2017 at 14:08
  • 3
    At the end I added a comment stating that the provided line does not work with spaces and I provided mine, correctly working.
    – FarO
    Commented Jan 1, 2017 at 14:08
  • 2
    Nevertheless, I cannot see a command line, subject to changes to the switches, as code... Code is code and, if correct, is always valid. Command lines may need to be modified to update the switches, especially from something-not-POSIX to POSIX (and then no need to change them anymore). But in this case, it was really not working with some specific file names.
    – FarO
    Commented Jan 1, 2017 at 14:10
  • 8
    -1; whatever the merits of this particular case, the claim that "We should never make code-edits to answers" is wrong. The When should I make edits to code? FAQ entry makes clear that not all code edits are bad, and that some kinds are outright encouraged.
    – Mark Amery
    Commented Jan 1, 2017 at 21:10
  • 6
    @Braiam You've been arguing this perspective across meta for a while now, and every time you've submitted an answer to such a question, the votes have shown the community doesn't agree. I think at some point you need to step back and accept that yours is not the consensus view. And, if you want to change that, maybe take a more diplomatic approach than calling the majority opinion "pure rubbish". Commented Jan 2, 2017 at 0:58
  • 2
    @ChrisHayes you know what Justin Bieber and PHP has in common? That both prove conclusively that you don't have to be good to be popular. My position is aligned with the help center (how can you argue against the guidance of guidances?), the very CM's through the site (Shog even made fun of what you call "consensus"), and even recent guidance about the topic. So, sorry for being so hell bent on this issue, but that's what this site was designed for: a wiki for canonical answers to programing Q's.
    – Braiam
    Commented Jan 2, 2017 at 1:06
  • 7
    Please do not spread confusion and misinformation. The rule is not to modify code in questions, unless it is impossible that the edit can accidentally fix the problem. Code in answers can and should be edited according to the same rule of preserving intent as anything else in the answer. This nonsense of "don't edit code in answers!1!!" needs to die. Commented Jan 2, 2017 at 7:54
  • 2
    @NathanTuggy I will never edit someones come unless it's a very very clear typo, or unless I'm 100% sure OP made some naming mistake or something like that.
    – Maroun
    Commented Jan 2, 2017 at 7:56
  • 3
    @ChrisHayes: Well, seems the votes are swinging the other way this time around :) Commented Jan 3, 2017 at 12:21
  • 2
    @MarounMaroun: I'm not condoning his attitude (though I understand it can get annoying to reiterate the same point over and over, it doesn't excuse anything). On the other hand, I think it's a worthy goal as a community to strive for up-to-date answers. It's really annoying to find answers from 2009 that haven't been updated to keep up with the latest developments: in 2009 they were useful, but 8 years later? And the worst part is that most of the time the answer is quite fine (the initial reasoning is good), it's just the code that could be massively cleaned-up/improved. Commented Jan 3, 2017 at 12:56
  • 3
    RE your edit: obviously if the question is about Fedora, then editing the answer with details about Ubuntu is a bad edit. That doesn't at all justify why correcting technical errors in answers (whether to code or text) is unacceptable. And if you're doing some kind of silly strike-through formatting, then please just stop. Really. That's ugly, noisy, and stupid. Either you're confident enough to make the edit, or you're not and you should leave a wimpy comment instead.
    – Cody Gray Mod
    Commented Jan 3, 2017 at 14:18
0

Personally I'd go with your third choice (posting your own answer), then again, unless it's something not that important or a "heads up", it should go as a comment.

Then again, you need 50 reputation to post a comment. Thus sometimes the heads up comments can be missed and not even noted. Which is annoying.

I am well aware that this is how SO works and it saves the hassle of shifting through a sea of spam, but sometimes limitations just impose inconveniences and discourages sharing your experience.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .