Bug 757182 - Validation of --lang on install_book verb, possibly others.
Summary: Validation of --lang on install_book verb, possibly others.
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Publican
Classification: Community
Component: publican
Version: 2.7
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: 3.0
Assignee: Jeff Fearn 🐞
QA Contact: Ruediger Landmann
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-11-25 17:36 UTC by Stephen Gordon
Modified: 2012-10-31 03:11 UTC (History)
3 users (show)

Fixed In Version: 3.0.0
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-10-31 03:11:46 UTC


Attachments (Terms of Use)

Description Stephen Gordon 2011-11-25 17:36:47 UTC
Description of problem:

When using Publican install_book verb it appears that messing up the input to the --lang parameter can have fairly severe consequences. In this case I used tab-completion resulting in issuing the following command:

$ publican install_book --site_config /home/sgordon/Source/web/homepage.cfg --lang en-US/

Instead of:

$ publican install_book --site_config /home/sgordon/Source/web/homepage.cfg --lang en-US

Publican happily process this but the result on the given site is unexpected, in particular:

- The drop down has a second entry for 'English' added to it - one for 'en-US' and one for 'en-US/'.
- The default selection appears to end up corresponding to 'en-US/', as such all books other than the one published with the incorrect command show up as untranslated.

I am guessing it would be difficult to include validation in publican for every possible language code, but I am raising this bug in the hope that:

- The trailing slash be stripped as part of the input validation to better accommodate tab completion (or ignored in the logic that caused the above issues).
- The language parameter for the install_book verb (possibly others?) be validated to ensure that a directory for the named language actually exists in the current directory. From what I work out this sort of happens at the moment, for instance:

$ publican install_book --site_config /home/sgordon/Source/web/homepage.cfg --lang klingon
subtitle can not be calculated before building. at /usr/bin/publican line 984

But it would be a 'nice to have' to be more explicit.

Version-Release number of selected component (if applicable):

publican-2.8-1.fc16.noarch

TL;DR: I am lazy and used tab-completion. As a result I temporarily broke docs.fedoraproject.org. Facepalm :(.

Comment 1 Jeff Fearn 🐞 2011-11-28 23:18:05 UTC
Changed bash_completion command for --lang so trailing slash isn't generated.

Applied to branches/publican-2x and trunk.

Committed revision 1959.

Comment 2 Laura Novich 2012-04-24 12:27:38 UTC
ok the change now causes the following error message:

Invalid build request: no PO files exist for language en-US/

Comment 3 Andrew Ross 2012-07-18 04:39:22 UTC
(In reply to comment #2)
> ok the change now causes the following error message:
> 
> Invalid build request: no PO files exist for language en-US/

Vased on issues in found in this bug, moving from VERIFIED back to ASSIGNED.

Comment 4 Andrew Ross 2012-07-18 04:40:45 UTC
> Vased on issues in found in this bug, moving from VERIFIED back to ASSIGNED.
Lol Based*

Comment 5 Andrew Ross 2012-07-18 05:49:50 UTC
Works for publican install_book.

Test_Book]$ publican install_book --site_config ../website/foomaster.cfg --lang en-US/
Test_Book]$ 



Note: it doesn't work for publican build. I got the same output as Laura did in comment#2

publican build -f html,html-single -l en-US/
Setting up en-US/
Invalid build request: no PO files exist for language en-US/ at /usr/bin/publican line 887

Comment 6 Jeff Fearn 🐞 2012-07-26 03:01:11 UTC
(In reply to comment #5)
> Works for publican install_book.
> 
> Test_Book]$ publican install_book --site_config ../website/foomaster.cfg
> --lang en-US/
> Test_Book]$ 
> 
> 
> 
> Note: it doesn't work for publican build. I got the same output as Laura did
> in comment#2
> 
> publican build -f html,html-single -l en-US/
> Setting up en-US/
> Invalid build request: no PO files exist for language en-US/ at
> /usr/bin/publican line 887

Removed support for undocumented options.


$ publican build -l en-US/
Unknown option: l
Usage:
...

It's not possible to support short options properly with bash-completion because the context for it changes with the usage but bash completion happens before publican can intervene.

Comment 7 Ruediger Landmann 2012-07-27 01:14:26 UTC
Confirmed that the short options are no longer in publican-3.0-0.fc17.t213.noarch and that tab completion no longer includes a trailing slash.


Note You need to log in before you can comment on or make changes to this bug.