Bug 757182 - Validation of --lang on install_book verb, possibly others.
Validation of --lang on install_book verb, possibly others.
Status: CLOSED CURRENTRELEASE
Product: Publican
Classification: Community
Component: publican (Show other bugs)
2.7
Unspecified Unspecified
unspecified Severity unspecified
: 3.0
: ---
Assigned To: Jeff Fearn
Ruediger Landmann
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-25 12:36 EST by Stephen Gordon
Modified: 2012-10-30 23:11 EDT (History)
3 users (show)

See Also:
Fixed In Version: 3.0.0
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-10-30 23:11:46 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Stephen Gordon 2011-11-25 12:36:47 EST
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 18:18:05 EST
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 08:27:38 EDT
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 00:39:22 EDT
(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 00:40:45 EDT
> Vased on issues in found in this bug, moving from VERIFIED back to ASSIGNED.
Lol Based*
Comment 5 Andrew Ross 2012-07-18 01:49:50 EDT
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-25 23:01:11 EDT
(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-26 21:14:26 EDT
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.