Tuesday, January 26, 2016

TIFU - when a dash is not a dash.

Originally posted on http://imgur.com/8rPBKac and on
https://www.reddit.com/r/raspberry_pi/comments/42t96g/tifu_when_a_dash_is_not_a_dashdont_cutpaste_from/


Let me share my silly little story.
Took me two nights of ever increasing frustration to figure out.
Makes me feel a little stupid.   ;-)

So I am doing multiple small projects on my Raspberry, playing around on my home network with DNSMASQ, recording aircraft positions with Dump1090/ADS-B, etc. Now I started using cloud-hosted MySQL database (AWS RDS) to store and analyze my data. Setting up the DB on Aamazon was quick, connecting to it with the MySQL Workbench worked fine. But I wanted to insert data from the Raspberry shell, using the mysql-client software. Again, installing it was easy (apt-get…yada yada..).

But then…launching the mysql monitor shell on a remote DB server…what exactly was the right syntax again?
                        mysql -h mydb.blablabla.aws-region.rds.amazonaws.com -u username -ppassword


Easy...but mysql just displayed the help info. Or „Access denied“. I googled and googled, and tried all the tips (yes, I reset the password, yes, I created a new DB user, yes, I granted all the privileges, yes, I checked the DB access rules, ....).  Either mysql showed me the help info or an „access denied“ error. Password in quotation marks and ticks. Without ticks. Still no success. Reinstalled mysql. Reimaged the Raspberry image. Still, no success.  WTF??

Then it hit me. I am using MS Word to keep notes. Cut& paste commands. Screenshots.
Copy in Raspberry, paste in Word. Copy in Word, paste in Raspberry.

Word is very nice to help me format my text to make it look nice.
And subtly changing the text. Like changing a a short dash (-) to a long dash (–). 

And the evil bit: when you copy the long or short dash to the prompt you don’t see any difference.

Do you spot a difference between the following lines?  In Word you can...on the shell you cannot:
mysql -h database.instance.eu-central-1.rds.amazonaws.com -u espmaster –p   
mysql -h database.instance.eu-central-1.rds.amazonaws.com -u espmaster -p

So, I learned that a –  is not the same as a  -.  Even if it looks identical.
long and short dash are not the same...






No comments:

Post a Comment