Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 614400 - app-misc/todo: broken bash completion
Summary: app-misc/todo: broken bash completion
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Patrice Clement (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-01 08:04 UTC by Ferenc Erki
Modified: 2017-04-08 22:02 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
todo-2.10-r1.ebuild (todo-2.10-r1.ebuild,777 bytes, text/plain)
2017-04-08 13:36 UTC, Ferenc Erki
Details
todo-2.10-todo_completion.patch (todo-2.10-todo_completion.patch,344 bytes, patch)
2017-04-08 13:38 UTC, Ferenc Erki
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ferenc Erki 2017-04-01 08:04:04 UTC
It seems like app-misc/todo renames the original executable named `todo.sh`
and that breaks bash completion for it.

Related emerge complaint:

 * Problems with installed bash completions were found:
 *
 * 	todotxt: incorrect name, no completions for 'todotxt' command defined.
 * 	todo.sh: missing alias (symlink) for completed command.
 *
 * For more details on installing bash-completions, please see:
 * https://wiki.gentoo.org/wiki/Bash/Installing_completion_files

/usr/share/bash-completion/completions/todo mentions:

# If you have renamed the todo.sh executable, or if it is not accessible through
# PATH, you need to add and use a wrapper completion function, like this:
#_todoElsewhere()
#{
#    local _todo_sh='/path/to/todo2.sh'
#    _todo "$@"
#}
#complete -F _todoElsewhere /path/to/todo2.sh

I see a couple of ways from here:

Using the original `todo.sh` name could fine too, given that:
 - it seems like to be the long established standard name for it from upstream
 - the existing users of todo.txt-cli might already got used to it and/or
   built their own aliases/settings/etc. based on this name

If we insist on changing the name from `todo.sh`, then probably we'd also need
to patch the bash completion too in order to reflect the same change.

Or the mix of both: install with the original `todo.sh` name, but also
install a symlink with the preferred name (`todotxt` currently), and also
patch the bash completion to complete both. Though it seems a lot more work
than the others :)

If given the strategy to follow, I think I can even attach updates here - let
me know!
Comment 1 Ferenc Erki 2017-04-08 13:36:59 UTC
Created attachment 469496 [details]
todo-2.10-r1.ebuild

Ebuild which:
 - installs original "binary" name from upstream
 - symlinks "todotxt" to it
 - patches bash completion to work with both
Comment 2 Ferenc Erki 2017-04-08 13:38:03 UTC
Created attachment 469498 [details, diff]
todo-2.10-todo_completion.patch

Patch bash completion to wokr both with todo.sh and todotxt commands.
Comment 3 Ferenc Erki 2017-04-08 13:40:37 UTC
@monsieurp: please review attached modifications. I tried to keep current status intact (that is, using a renamed todotxt "binary" in gentoo), but I think upstream's todo.sh alone would do too.

Let me know if "only todo.sh" is not a good idea and/or if you would like me to modify the attached patches.
Comment 4 Patrice Clement (RETIRED) gentoo-dev 2017-04-08 22:02:20 UTC
commit 3ab41e097caa4a39f508aee73da35d51bb9d69c4 (HEAD -> master, origin/master, origin/HEAD)
Author:     Patrice Clement <monsieurp@gentoo.org>
AuthorDate: Sat Apr 8 23:56:11 2017 +0200
Commit:     Patrice Clement <monsieurp@gentoo.org>
CommitDate: Sat Apr 8 23:56:11 2017 +0200

app-misc/todo: add patch to fix bash completion.

Courtesy of Ferenc Erki <erkiferenc@gmail.com>.

Gentoo-Bug: https://bugs.gentoo.org/614400

Package-Manager: Portage-2.3.3, Repoman-2.3.1

.../todo/files/todo-2.10-fix-bash-completion.patch | 12 ++++++++
app-misc/todo/todo-2.10-r1.ebuild                  | 35 ++++++++++++++++++++++
2 files changed, 47 insertions(+)
create mode 100644 app-misc/todo/files/todo-2.10-fix-bash-completion.patch
create mode 100644 app-misc/todo/todo-2.10-r1.ebuild

Your contribution has been merged. No problem on my end as far as renaming the script goes. It it enables the bash completion script to work, then let's do it. Thanks.