Closed Bug 663048 Opened 13 years ago Closed 9 years ago

Unicode directory names raises package name value error

Categories

(Add-on SDK Graveyard :: General, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: arky, Unassigned)

References

Details

User-Agent:       Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Build Identifier: 

Looks like the SDK has trouble directory names with spaces or unicode names.


* With spaces (Foo Bar)
raise ValueError('package names cannot contain spaces or periods: %s' % name)

* With Unicode name (tức)

raise ValueError('invalid resource hostname: %s' % name)

Reproducible: Always
For the spaces case, it'd probably be pretty easy to switch spaces to underscores to be written to package.json, assuming underscores are allowed.
This seems less likely to occur than the related bug about capital letters in directory names, and thus it doesn't rise to the level of a blocker, but it is definitely important to fix, and we should make sure to mention it in the release notes.
Keywords: relnote
Priority: -- → P1
Target Milestone: --- → Future
Severity: critical → normal
Priority: P1 → P2
Target Milestone: Future → 1.2
(Pushing all open bugs to the --- milestone for the new triage system)
Target Milestone: 1.2 → ---
Status: UNCONFIRMED → NEW
Ever confirmed: true
A similar but different issue reported in the forum: https://forums.mozilla.org/addons/viewtopic.php?f=27&t=14139.
This problem still exists in latest master branch.


$ source ~/src/addon-sdk/bin/activate
Welcome to the Add-on SDK. Run 'cfx docs' for assistance.

(addon-sdk)arky@Arky-Think:~/src/addon-sdk$ cd /tmp/
(
addon-sdk)arky@Arky-Think:/tmp$ mkdir tức

(addon-sdk)arky@Arky-Think:/tmp$ cd tức/

(addon-sdk)arky@Arky-Think:/tmp/tức$ ls

(addon-sdk)arky@Arky-Think:/tmp/tức$ cfx init
* lib directory created
* data directory created
* test directory created
* doc directory created
* README.md written
* package.json written
* test/test-main.js written
* lib/main.js written
* doc/main.md written

Your sample add-on is now ready.
Do "cfx test" to test it and "cfx run" to try it.  Have fun!

(addon-sdk)arky@Arky-Think:/tmp/tức$ cfx run
No 'id' in package.json: creating a new ID for you.
package.json modified: please re-run 'cfx run'
(addon-sdk)arky@Arky-Think:/tmp/tức$ cfx run
Traceback (most recent call last):
  File "/home/arky/src/addon-sdk/bin/cfx", line 33, in <module>
    cuddlefish.run()
  File "/home/arky/src/addon-sdk/python-lib/cuddlefish/__init__.py", line 741, in run
    is_running_tests=(command == "test")
  File "/home/arky/src/addon-sdk/python-lib/cuddlefish/packaging.py", line 372, in generate_build_for_target
    add_section_to_build(target_cfg, "tests", is_code=True)
  File "/home/arky/src/addon-sdk/python-lib/cuddlefish/packaging.py", line 315, in add_section_to_build
    print err
UnicodeEncodeError: 'ascii' codec can't encode character u'\u1ee9' in position 171: ordinal not in range(128)
(addon-sdk)arky@Arky-Think:/tmp/tức$
Flags: needinfo?(myk)
Hi arky, I see that a problem exists, per your comment showing an error report.  But it's unclear what info you're looking for, since you don't ask a question.  Can you elaborate?
Flags: needinfo?(myk)
(In reply to Myk Melez [:myk] [@mykmelez] from comment #6)
> Hi arky, I see that a problem exists, per your comment showing an error
> report.  But it's unclear what info you're looking for, since you don't ask
> a question.  Can you elaborate?

Retesting and closing all my old Add-on SDK bugs. Surprised to see this one still around. 

Am not a pythonista. What does it take to try to patch this issue?
Adding a test for unicode directory names in validate_resource_hostname() is good way patch this ?
I'm not a pythonista either, but I suspect validate_resource_hostname() is the wrong place.  Either the *name* field in package.json can't contain such characters, in which case `cfx init` should sanitize it when generating the file; or whatever accesses package.json should do so using the proper codec instead of the *ascii* one.
Keywords: relnote
Sorry we won't be releasing any new versions of cfx, jpm is the replacement https://www.npmjs.com/package/jpm
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.