Ticket #6985 (closed defect: fixed)

Opened 21 months ago

Last modified 21 months ago

sugar-install-bundle dies when no parameters are passes.

Reported by: ffm Owned by: marco
Priority: high Milestone: 8.1.1 (was Update1.1)
Component: sugar Version: Development build as of this date
Keywords: Cc:
Action Needed: Verified: no
Deployments affected: Blocked By:
Blocking:

Description

Downstream bug (with logs and such): Launchpad.net

This issue occurred because the command was called with no parameters.

Ideally, it should provide a nice usage message, that explains what the command does.

Attachments

error_handle.diff (0.6 kB) - added by ffm 21 months ago.
git-diff of the proposed change

Change History

  Changed 21 months ago by ffm

Traceback:

Traceback (most recent call last):

File "/usr/bin/sugar-install-bundle", line 9, in <module>

bundle = ActivityBundle(sys.argv[1])

IndexError: list index out of range

Changed 21 months ago by ffm

git-diff of the proposed change

  Changed 21 months ago by ffm

  • owner changed from marco to ffm
  • milestone changed from Never Assigned to Update1.1

  Changed 21 months ago by ffm

  • owner changed from ffm to marco

follow-up: ↓ 5   Changed 21 months ago by erikos

I actually would handle it like this - since only one argumant is supported:

+def cmd_help():
+    print 'Usage: sugar-install-bundle [ bundlename ] \n\n\
+    Install an activity bundle (.xo). \n'
+
+if len(sys.argv) != 2:
+    cmd_help()
+    sys.exit(2)
+
 bundle = ActivityBundle(sys.argv[1])
 bundle.install()

in reply to: ↑ 4   Changed 21 months ago by ffm

Replying to erikos:

I actually would handle it like this - since only one argumant is supported:

Sure, that'd work well too.

  Changed 21 months ago by erikos

  • status changed from new to closed
  • resolution set to fixed

I pushed the fix to sugar git master, thanks for spotting and patch.

Note: See TracTickets for help on using tickets.