mongodump "too many positional options have been specified on the command line"

Bug #1668903 reported by Yaron
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mongodb (Ubuntu)
Fix Released
Undecided
Unassigned
Xenial
Triaged
Undecided
Unassigned
Yakkety
Triaged
Undecided
Unassigned

Bug Description

I can't run the mongodump utility in Ubuntu (from the internal packages).

Running without any parameters works BTW.

I tried running a dump this way:
mongodump -u xxxx -p xxxx --host somehost.com:27017 -d some_db -o backup

And I got this reply:
Error parsing command line: too many positional options have been specified on the command line
try 'mongodump --help' for more information

Then I purged the package using:
apt purge mongodb

And then added the official mongo repo as explained on the mongo website:
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/

Ran the same command again and voila! it worked.
I tried search for the "too many positional" error and found out it might have something to do with some problematic minus or em-dash/en-dash but it's not the case because I wrote everything manually and the same command exactly worked with the official mongodb-org by mongo.

Tags: mongo
Yaron (sh-yaron)
tags: added: mongo
description: updated
Yaron (sh-yaron)
description: updated
Revision history for this message
Nish Aravamudan (nacc) wrote :

Hello and thank you for filing this bug report.

Note that the `mongodump --help` output states:

  -h, --host=<hostname> mongodb host to
                                                            connect to
                                                            (setname/host1,host-

Have you tried:

mongodump -u xxxx -p xxxx --host=somehost.com:27017 -d some_db -o backup

?

As far as I can tell, mongodump has no positional arguments, so it's rather confusing.

I am unable to reproduce the issue, in any case, on 17.04 (with or without '='). What version of Ubuntu are you running?

Changed in mongodb (Ubuntu):
status: New → Incomplete
Revision history for this message
Yaron (sh-yaron) wrote :

16.10.

If it's solved up simply upgrade my Ubuntu version.

Nish Aravamudan (nacc)
Changed in mongodb (Ubuntu):
status: Incomplete → New
assignee: nobody → Nish Aravamudan (nacc)
Revision history for this message
Nish Aravamudan (nacc) wrote :

Ok, I have reproduced the issue on 16.10 and it does seem fixed on 17.04. While, I agree you can upgrade, 17.04 is beta still and we should fix it properly (especially if 16.04 is also affected). Let me debug it a bit further and see if we can't get a fix out soon.

Revision history for this message
Nish Aravamudan (nacc) wrote :

It does seem that mongodump has been rewritten in the first in 17.04 in go. So I think both 16.04 and 16.10 are affected, but not 17.04. I am working on testing a fix to the source still.

Changed in mongodb (Ubuntu):
status: New → Fix Released
assignee: Nish Aravamudan (nacc) → nobody
Changed in mongodb (Ubuntu Xenial):
assignee: nobody → Nish Aravamudan (nacc)
Changed in mongodb (Ubuntu Yakkety):
assignee: nobody → Nish Aravamudan (nacc)
Changed in mongodb (Ubuntu Xenial):
status: New → Triaged
status: Triaged → In Progress
Changed in mongodb (Ubuntu Yakkety):
status: New → In Progress
Revision history for this message
Nish Aravamudan (nacc) wrote :

Note that skipping the space between -p and the password seems to work here. I don't know why yet.

Revision history for this message
Yaron (sh-yaron) wrote :

@nacc peculiar, this is the only change you've made to the arguments?

Revision history for this message
Nish Aravamudan (nacc) wrote :

Yes, that's right. Alternatively, you can just pass -p and it will prompt for the password.

If I had to guess, this is a buggy implementation of the code to elide the password from the comm of the process (so you don't see it in ps aux, I think). I wonder if it doesn't recognize the space between -p and the password, so it treats the password as a positional argument.

Oddly, if I build the same source without the flags we pass during the .deb build, I don't get this behavior.

While annoying, there is an easy workaround for now.

Revision history for this message
Nish Aravamudan (nacc) wrote :

Alternatively, we can at least update the help and manpage to document the behavior.

Revision history for this message
Nish Aravamudan (nacc) wrote :

I don't know that we will fix this in 16.04 -- it's a low priority issue with a pretty easy workaround. Just an FYI.

Changed in mongodb (Ubuntu Xenial):
status: In Progress → Triaged
Changed in mongodb (Ubuntu Yakkety):
status: In Progress → Triaged
Changed in mongodb (Ubuntu Xenial):
assignee: Nish Aravamudan (nacc) → nobody
Changed in mongodb (Ubuntu Yakkety):
assignee: Nish Aravamudan (nacc) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.