The failure modes of rsync
-
So I wanted to know what happens if I'd mess up and rsync a directory with itself.
gleemonk@basement$ mkdir test gleemonk@basement$ touch test/lol gleemonk@basement$ rsync -r test test gleemonk@basement$ rsync -r test test gleemonk@basement$ rsync -r test test gleemonk@basement$ rsync -r test test gleemonk@basement$ rsync -r test test gleemonk@basement$ find test test test/lol test/test test/test/lol test/test/test test/test/test/lol test/test/test/test test/test/test/test/lol test/test/test/test/test test/test/test/test/test/lol test/test/test/test/test/test test/test/test/test/test/test/lol gleemonk@basement$
Now of course everybody immediately spots the missing slash because you've misplaced and bloated directory trees before due to the missing slash. The properly trained monk uses
rsync -r test/ test
and rsync acutally does nothing because the directories do not differ. My bad. All that foot shooting will make me a better monkey I'm sure.
-
So what's the WTF? That rsync doesn't warn you about an obvious error?
-
Well it's open source software, so the WTF is that it didn't break
-
That rsync doesn't warn you about an obvious error?
it's not an error.
rsync is doing a valid operation and exactly what you asked it to do.
I'm not a fan of the syntax but....
rsync -r foo bar
means 'Recursively copy the folder foo into bar'
rsync -r foo/ bar
means 'Recursively copy the contents of folder foo into bar'rsync -r foo bar/
means 'I'm doing to do whatrcp
would have done in this situation but you almost cerrtainly didn't mean to do that!'the funky syntax, including this subtle and pretty massive gotcha, are a legacy of
rsync
's status as a replacement forrcp
and the developers decision to make it option compatible so you couldln -s /usr/bin/rsync /usr/bin/rcp
and have old scripts work just fine.I wish though they would add a warning at least for copying a folder structure into a subdirectory of itself.
-
You think someone would write that on purpose?
the funky syntax, including this subtle and pretty massive gotcha, are a legacy of rsync's status as a replacement for rcp and the developers decision to make it option compatible so you could ln -s /usr/bin/rsync /usr/bin/rcp and have old scripts work just fine.
Right; it's shitty, and it'll always be shitty, because if you're using Linux nothing can ever be improved. Ever. Welcome to ass.
-
There are few use cases where you would clone a directory into itself. So refusing to do it would be justified I feel. I know that rsync is designed to be used remotely, where figuring this out might be impossible or very expensive. So I can accept that rsync does not do it.
The slash thing is a violation of the custom that slashes at the end of a path are irrelevant. I know of no other tool that uses this distinction.
the funky syntax, including this subtle and pretty massive gotcha, are a legacy of rsync's status as a replacement for rcp
I don't know whether learning this made my day better or worse.
-
Right; it's shitty, and it'll always be shitty
This we agree on.because if you're using Linux nothing can ever be improved. Ever.
I invite you to take a look at the microsoft's own Batch File language and see what a crock of shit that is. I invite you to look at the history of bugs in those basic commands (including the epic one in find) that can now never be fixed and instead are being carefully preserved in every new version of their operating system.Linux isn't the only one dealing with legacy shit.
Welcome to ass.
Thhanks for the welcome, but i'm just passing through on my way somewhere else.
-
I invite you to take a look at the microsoft's own Batch File language and see what a crock of shit that is.
But that's deprecated and has been for decades.
rsync is not.
-
Linux isn't the only one dealing with legacy shit.
You need to learn to ignore him on those sorts of rants. He's just channeling certain corners of slashdot when he does that. No amount of facts or history will convince him.
-
But that's deprecated and has been for decades.
deprecated, maybe.
still supported.
You need to learn to ignore him on those sorts of rants.
where is the fun in that?!
-
-
-
@accalia said:
(including the epic one in find)
Does the "findstr" command have this bug as well?
Not sure, I'd have to look at the documentation. I'd doubt it.
Bookmarked for future reference.
just make sure you get teh context correct. everything is context.
-
FindStr is so nice. Much more powerful
-
The slash thing is a violation of the custom that slashes at the end of a path are irrelevant. I know of no other tool that uses this distinction.
Yeah... I'd expect
foo
orfoo/
to refer to the folder itself, andfoo/*
to refer to the contents. It's pretty intuitive thatrsync -r foo foo
should copyfoo
recursively intofoo
(just be glad it's not an infinite loop), but that notation where you add slashes after the folder names is weird.
-
But that's deprecated and has been for decades.
You keep saying that, but I've never seen anything that remotely supports that claim. In fact, only in Windows 10 did Microsoft provide a way to change the default command line shell to powershell. So I call bullshit unless you can back that claim up.
-
it'll always be shitty, because if you're using Linux nothing can ever be improved. Ever.
Whereas if you're using Windows all you get is Robocopy, so your expectations can be abysmally low from the get-go.
-
You keep saying that, but I've never seen anything that remotely supports that claim.
It was replaced by Windows Scripting Host in like Windows 98.
-
It was replaced by Windows Scripting Host in like Windows 98.
[Citation Needed]
Windows was also replaced by Linux in 1998. That was an official Microsoft statement!(You see what happens when you make random statements without backing them up?)
-
DOS -> CMD -> Windows Scripting Host -> Running Management Snap-Ins Remotely -> PowerShell
CMD is like 4 generations behind.
-
Doesn't mean it's deprecated.
As far as I can tell, it's a fully supported Microsoft product. Meaning it's as valid of a target as anything else.You like to make fun of Linux tools when they're also replaced by modern alternatives, but pull the "It's deprecated!" card whenever someone targets CMD.exe
-
Something can be both supported and deprecated
-
Well yeah.
But our rat friend still hasn't shown any proof of it being deprecated. Other than "There are newer, better things!"
Hence the [Citation Needed] :)
-
bash-3.1$ dir /w bash: dir: command not found bash-3.1$
Garbage.
-
If cmd was deprecated, they wouldn't make improvements to it in Windows 10.
-
-
Cite these improvements?
For legitimate purposes of course
-
They weren't particularly huge, but there are improvements to the console window. Also, in the last few Windows releases, command line tools have been added.
This is about Vista/7 but it's still way past the time period @Blakey says cmd was deprecated.
@Gaska may have been talking about other ones too. If so he would have add them, since he was the one who made the claim originally.
-
damn, maybe I should check out Windows 10...
Also maybe Blakey is being a pedant, COMMAND.COM was replaced a long time ago, as in, the NT days
I would also like to invoke a rule from Raymond: Microsoft are people too, they build shitty software sometimes too. That doesn't necessarily excuse Linux from making the same mistakes
-
-
Why are they labeled as "Experimental"? In fact that directly contradicts that they are supported.
-
Doesn't mean it's deprecated.As far as I can tell, it's a fully supported Microsoft product.
It's both. The two are not mutually-exclusive.
If cmd was deprecated, they wouldn't make improvements to it in Windows 10.
They didn't.
They weren't particularly huge, but there are improvements to the console window.
Oh so when you said "CMD" what you meant is the console window. You know, the one used by the current PowerShell as well.
So far I've learned from the morons in this thread:
-
Deprecated and supported are somehow mutually-exclusive
-
The console window and CMD are in fact the exact same thing
THE WISDOM!
-
-
Perhaps.
COMMAND.COM
was deprecated... and then removed completely after XP IIRC.
-
And what I've learned:
Blakey doesn't know how to provide proof of something.
Therefore, I win the argument.
That's how it works, right?
Also, why the belgium would Microsoft be adding new tools for a deprecated product?
Why is a deprecated product the go-to recovery environment?
http://cdn.pureinfotech.com/wp-content/uploads/2011/10/uninstall-windows-8-windows-7-command-prompt.png?681c7aNote: That is CMD, not any of the replacements. Clearly CMD is not deprecated if it's the only thing that can be accessed in a recovery environment
-
Why are they labeled as "Experimental"? In fact that directly contradicts that they are supported.
The sole fact they're messing with it in any way is enough to prove my point.
-
Hi - I assume your term for 'person' is 'moron', so I don't take any offense there. However, once again, you're talking about Unix. Unix is for grownups. So shut the fuck up, and use your PowerShell, and pretend all you like that you have any clue about anything.
Maybe you should look into extending PowerShell with VB.NET, so you can blow happy spit bubbles for 3 years or so and not have so much time to make an ass of yourself.
-
Not true. Exhibit A: Google Wave. Significant amounts of "messing about" went into that and it was never legitimately supported in any fashion. Those changes were some guy's bored project that he had to beg his boss to allow, hence the "Experimental" qualifier. Experimental == Supported Feature
-
Oh so when you said "CMD" what you meant is the console window.
When I say cmd, I mean whatever opens up when I type "cmd" in Start menu search bar and hit enter.
-
Not true. Exhibit A: Google Wave. Significant amounts of "messing about" went into that and it was never legitimately supported in any fashion.
They were offering this service to people, therefore they were supporting it. Legal bullshit and pedantic dickweedery is of no interest to me.
-
The console window that Blakey is talking about is the front end to the command parser (cmd) that you are talking about. The command window can be modified without an edit to the underlying command parser
therefore they were supporting it
In the software industry, "Support" has a specific definition for a reason. It doesn't matter what you feel, the fact is, it is all ABOUT the pedantic dickweedery.Blame the game, not the players
I have made several programs that I offer to people, doesn't mean I will support them if they were shit and toys
-
Blakey -
What I'm asking for is a deprecation notice.
Companies like Microsoft do that when they deprecate a product.
Here's an example: https://technet.microsoft.com/en-us/mt210917.aspxUntil you provide one of those, CMD is no more deprecated than the majority of these tools you like to bash and is therefore equally valid of a target as them.
Backwards compatibility sucks, but it's there. It's needed.
Any tool that's backwards compatible is probably gonna have a bit of factor in it, irrelevant of whether it's FOSS or not.
-
Bottom line:
Windows/Microsoft sucks
Linux/OSS sucks
OSX/Apple sucks
-
Usually, support means adding new features and fixing bugs. Usually, when support stops, there are no more updates ever again (unless the support gets extended, which means the support is still there).
Deprecating stuff has a goal of making the clients stop using it. Adding stuff incentives the clients to keep using it - so it's in opposition to deprecation.
-
Bottom line:
Windows/Microsoft sucks
Linux/OSS sucks
OSX/Apple sucks
QFT.
The way you get past it is you embrace the suck... become one with the suck. Then you truly are a programmer. Or you're part of the problem. One of the two.
-
-
Unix / linux User Club Rules
Command Line Subset
- There shall be no sanity checking of the command you type in
- With root privileges, Rule 1 is applied in spades.
Codicil of the above Rules
-
To use command line you need to know what you are doing
-
To use command line as root, you had better bloody know exactly what you are doing
I know. Nobody has made any mention of root or su or sudo yet even in the context of Doing It Rightâ„¢, Doing It Wrongâ„¢ or even Doing It Not Rightâ„¢ But that is just a matter of time.
-
Actually, decent shells do some basic sanity checking. It's just that you have to be nigh-unto completely incomprehensible to be considered insane.
-
There can't be much sanity checking if basically every typable character has some special meaning in bash scripts.
^
included.
-
Not true, many of those characters are significant or valid only in particular contexts. You need to look back to, what was it, TECO, for something that truly has no sanity checking.
-
Sanity checks barrier #2 in Unix shell: everything that is not special character is valid path. Or at least valid input.