mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] fix typo in bash_completion
@ 2012-12-08 16:35 Daniel Kriesten
  2012-12-10  8:50 ` Michael Olbrich
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Kriesten @ 2012-12-08 16:35 UTC (permalink / raw)
  To: ptxdist

This prevents bash_completion from working correctly.

Signed-off-by: Daniel Kriesten <krid@tu-chemnitz.eu>
---
scripts/bash_completion | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/bash_completion b/scripts/bash_completion
index ea3921d..719cb35 100644
--- a/scripts/bash_completion
+++ b/scripts/bash_completion
@@ -112,7 +112,7 @@ _ptxdist_completion()
		;;
	clean)
		COMPREPLY=( root )
-		;&
+		;;
	get|extract|prepare|compile|install|targetinstall|tags)
		COMPREPLY+=( $( compgen -W "$( $_ptxdist_cmd print PTX_PACKAGES_SELECTED 2> /dev/null)" -- $cur ) )
		;;
-- 
1.8.0


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ptxdist] [PATCH] fix typo in bash_completion
  2012-12-08 16:35 [ptxdist] [PATCH] fix typo in bash_completion Daniel Kriesten
@ 2012-12-10  8:50 ` Michael Olbrich
  2012-12-11 15:16   ` Daniel Kriesten
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Olbrich @ 2012-12-10  8:50 UTC (permalink / raw)
  To: ptxdist

On Sat, Dec 08, 2012 at 05:35:01PM +0100, Daniel Kriesten wrote:
> This prevents bash_completion from working correctly.
> 
> Signed-off-by: Daniel Kriesten <krid@tu-chemnitz.eu>
> ---
> scripts/bash_completion | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/bash_completion b/scripts/bash_completion
> index ea3921d..719cb35 100644
> --- a/scripts/bash_completion
> +++ b/scripts/bash_completion
> @@ -112,7 +112,7 @@ _ptxdist_completion()
> 		;;
> 	clean)
> 		COMPREPLY=( root )
> -		;&
> +		;;

Why this change? ";&" means fall through, like omitting then 'break' in C
code. This is intentional.

Michael

> 	get|extract|prepare|compile|install|targetinstall|tags)
> 		COMPREPLY+=( $( compgen -W "$( $_ptxdist_cmd print PTX_PACKAGES_SELECTED 2> /dev/null)" -- $cur ) )
> 		;;
> -- 
> 1.8.0
> 
> 
> -- 
> ptxdist mailing list
> ptxdist@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ptxdist] [PATCH] fix typo in bash_completion
  2012-12-10  8:50 ` Michael Olbrich
@ 2012-12-11 15:16   ` Daniel Kriesten
  2012-12-13 12:10     ` Daniel Kriesten
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Kriesten @ 2012-12-11 15:16 UTC (permalink / raw)
  To: ptxdist


[-- Attachment #1.1: Type: text/plain, Size: 2008 bytes --]

Oh - really. I didn't know this. So with today's pull a new revision of the completion script arrived.

So I double-checked the behavior on my Mac (GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)) and it fails. On my Linux Box (where it did not work either) the problem is an other and I have to further check it out.

So for now forget about this ...


Am 10.12.2012 um 09:50 schrieb Michael Olbrich:

> On Sat, Dec 08, 2012 at 05:35:01PM +0100, Daniel Kriesten wrote:
>> This prevents bash_completion from working correctly.
>> 
>> Signed-off-by: Daniel Kriesten <krid@tu-chemnitz.eu>
>> ---
>> scripts/bash_completion | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/scripts/bash_completion b/scripts/bash_completion
>> index ea3921d..719cb35 100644
>> --- a/scripts/bash_completion
>> +++ b/scripts/bash_completion
>> @@ -112,7 +112,7 @@ _ptxdist_completion()
>> 		;;
>> 	clean)
>> 		COMPREPLY=( root )
>> -		;&
>> +		;;
> 
> Why this change? ";&" means fall through, like omitting then 'break' in C
> code. This is intentional.
> 
> Michael
> 
>> 	get|extract|prepare|compile|install|targetinstall|tags)
>> 		COMPREPLY+=( $( compgen -W "$( $_ptxdist_cmd print PTX_PACKAGES_SELECTED 2> /dev/null)" -- $cur ) )
>> 		;;
>> -- 
>> 1.8.0
>> 
>> 
>> -- 
>> ptxdist mailing list
>> ptxdist@pengutronix.de
>> 
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 
> -- 
> ptxdist mailing list
> ptxdist@pengutronix.de
> 


-- 
Daniel Kriesten
Professur Schaltkreis- und Systementwurf
Technische Universität Chemnitz, Reichenhainer Str. 31-33, 09126 Chemnitz
Tel: +49 371 531 33058  Fax: +49 371 531 833058
http://www.tu-chemnitz.de/etit/sse


[-- Attachment #1.2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 4964 bytes --]

[-- Attachment #2: Type: text/plain, Size: 48 bytes --]

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ptxdist] [PATCH] fix typo in bash_completion
  2012-12-11 15:16   ` Daniel Kriesten
@ 2012-12-13 12:10     ` Daniel Kriesten
  2012-12-14 10:18       ` Michael Olbrich
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Kriesten @ 2012-12-13 12:10 UTC (permalink / raw)
  To: ptxdist


[-- Attachment #1.1: Type: text/plain, Size: 3142 bytes --]

Hi Michael,

may be you can once more lend my a hand …

As my Mac has Bash version 3, which is AFAIK deprecated for bash completion, I changed the script just to fit my needs.

On my linux box (recent Gentoo, bash 4.2.37) the issue is an other. If I log in, the completion is not loaded. If I start a new shell, the completion works. This seems to be related to the line

if have ptxdist

and the way Gentoo handles bash completion and the way I installed ptxdist. As far as I can see, ptxdist is not in the path when the completion scripts are executed at login as this is done by the global /etc/profile early in session startup. Simply removing the if statement solves this for me. But I guess there is a reason to check for ptxdist?

Regards
  Daniel

Am 11.12.2012 um 16:16 schrieb Daniel Kriesten:

> Oh - really. I didn't know this. So with today's pull a new revision of the completion script arrived.
> 
> So I double-checked the behavior on my Mac (GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)) and it fails. On my Linux Box (where it did not work either) the problem is an other and I have to further check it out.
> 
> So for now forget about this ...
> 
> 
> Am 10.12.2012 um 09:50 schrieb Michael Olbrich:
> 
>> On Sat, Dec 08, 2012 at 05:35:01PM +0100, Daniel Kriesten wrote:
>>> This prevents bash_completion from working correctly.
>>> 
>>> Signed-off-by: Daniel Kriesten <krid@tu-chemnitz.eu>
>>> ---
>>> scripts/bash_completion | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>> 
>>> diff --git a/scripts/bash_completion b/scripts/bash_completion
>>> index ea3921d..719cb35 100644
>>> --- a/scripts/bash_completion
>>> +++ b/scripts/bash_completion
>>> @@ -112,7 +112,7 @@ _ptxdist_completion()
>>> 		;;
>>> 	clean)
>>> 		COMPREPLY=( root )
>>> -		;&
>>> +		;;
>> 
>> Why this change? ";&" means fall through, like omitting then 'break' in C
>> code. This is intentional.
>> 
>> Michael
>> 
>>> 	get|extract|prepare|compile|install|targetinstall|tags)
>>> 		COMPREPLY+=( $( compgen -W "$( $_ptxdist_cmd print PTX_PACKAGES_SELECTED 2> /dev/null)" -- $cur ) )
>>> 		;;
>>> -- 
>>> 1.8.0
>>> 
>>> 
>>> -- 
>>> ptxdist mailing list
>>> ptxdist@pengutronix.de
>>> 
>> 
>> -- 
>> Pengutronix e.K.                           |                             |
>> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
>> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
>> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
>> 
>> -- 
>> ptxdist mailing list
>> ptxdist@pengutronix.de
>> 
> 
> 
> -- 
> Daniel Kriesten
> Professur Schaltkreis- und Systementwurf
> Technische Universität Chemnitz, Reichenhainer Str. 31-33, 09126 Chemnitz
> Tel: +49 371 531 33058  Fax: +49 371 531 833058
> http://www.tu-chemnitz.de/etit/sse
> 


-- 
Daniel Kriesten
Professur Schaltkreis- und Systementwurf
Technische Universität Chemnitz, Reichenhainer Str. 31-33, 09126 Chemnitz
Tel: +49 371 531 33058  Fax: +49 371 531 833058
http://www.tu-chemnitz.de/etit/sse


[-- Attachment #1.2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 4964 bytes --]

[-- Attachment #2: Type: text/plain, Size: 48 bytes --]

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ptxdist] [PATCH] fix typo in bash_completion
  2012-12-13 12:10     ` Daniel Kriesten
@ 2012-12-14 10:18       ` Michael Olbrich
  2012-12-14 12:28         ` Daniel Kriesten
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Olbrich @ 2012-12-14 10:18 UTC (permalink / raw)
  To: ptxdist

Hi,

On Thu, Dec 13, 2012 at 01:10:33PM +0100, Daniel Kriesten wrote:
> may be you can once more lend my a hand …
> 
> As my Mac has Bash version 3, which is AFAIK deprecated for bash completion,
> I changed the script just to fit my needs.
> 
> On my linux box (recent Gentoo, bash 4.2.37) the issue is an other. If I log
> in, the completion is not loaded. If I start a new shell, the completion
> works. This seems to be related to the line
> 
> if have ptxdist
> 
> and the way Gentoo handles bash completion and the way I installed ptxdist.
> As far as I can see, ptxdist is not in the path when the completion scripts
> are executed at login as this is done by the global /etc/profile early in
> session startup. Simply removing the if statement solves this for me. But I
> guess there is a reason to check for ptxdist?

The ptxdist bash_completion script should not be sourced directly. 'have'
is defined by bash_completion before it sources the application specific
scripts and later undefined. At least that's how it works on Debian. I have
a .bash_completion like this:
--------------------------------------
. /path/to/ptxdist/scripts/bash_completion

complete -F _ptxdist_completion p
--------------------------------------

Note: for this to work 'ptxdist' must be found in PATH when this is loaded.
I suppose you could also define 'have' in a way that it is always
successful before sourcing scripts/bash_completion

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ptxdist] [PATCH] fix typo in bash_completion
  2012-12-14 10:18       ` Michael Olbrich
@ 2012-12-14 12:28         ` Daniel Kriesten
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Kriesten @ 2012-12-14 12:28 UTC (permalink / raw)
  To: ptxdist


[-- Attachment #1.1: Type: text/plain, Size: 3010 bytes --]

Ok, so just to round this up and to help others who may struggle about the bash completion.

Using 'have' as a guard is probably a good idea in a environment like ubuntu or debian, where all completions are loaded by default (Although, the script would probably not be in its place if ptxdist is not installed). In Gentoo the user may choose the completion scripts he wants - making sure he only loads completions for installed tools.

On the other hand gentoo loads the completions quite early in the login process - far before ~/.{profile,bashrc} So the scripts do not see paths added by the user.

Thus the solution for gentoo (and probably other distributions with early loaded completions) is to simply remove the guard or reload the completions after setting user specific paths.

Regards,
  Daniel

Am 14.12.2012 um 11:18 schrieb Michael Olbrich:

> Hi,
> 
> On Thu, Dec 13, 2012 at 01:10:33PM +0100, Daniel Kriesten wrote:
>> may be you can once more lend my a hand …
>> 
>> As my Mac has Bash version 3, which is AFAIK deprecated for bash completion,
>> I changed the script just to fit my needs.
>> 
>> On my linux box (recent Gentoo, bash 4.2.37) the issue is an other. If I log
>> in, the completion is not loaded. If I start a new shell, the completion
>> works. This seems to be related to the line
>> 
>> if have ptxdist
>> 
>> and the way Gentoo handles bash completion and the way I installed ptxdist.
>> As far as I can see, ptxdist is not in the path when the completion scripts
>> are executed at login as this is done by the global /etc/profile early in
>> session startup. Simply removing the if statement solves this for me. But I
>> guess there is a reason to check for ptxdist?
> 
> The ptxdist bash_completion script should not be sourced directly. 'have'
> is defined by bash_completion before it sources the application specific
> scripts and later undefined. At least that's how it works on Debian. I have
> a .bash_completion like this:
> --------------------------------------
> . /path/to/ptxdist/scripts/bash_completion
> 
> complete -F _ptxdist_completion p
> --------------------------------------
> 
> Note: for this to work 'ptxdist' must be found in PATH when this is loaded.
> I suppose you could also define 'have' in a way that it is always
> successful before sourcing scripts/bash_completion
> 
> Michael
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 
> -- 
> ptxdist mailing list
> ptxdist@pengutronix.de


-- 
Daniel Kriesten
Professur Schaltkreis- und Systementwurf
Technische Universität Chemnitz, Reichenhainer Str. 31-33, 09126 Chemnitz
Tel: +49 371 531 33058  Fax: +49 371 531 833058
http://www.tu-chemnitz.de/etit/sse


[-- Attachment #1.2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 4964 bytes --]

[-- Attachment #2: Type: text/plain, Size: 48 bytes --]

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-12-14 12:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-08 16:35 [ptxdist] [PATCH] fix typo in bash_completion Daniel Kriesten
2012-12-10  8:50 ` Michael Olbrich
2012-12-11 15:16   ` Daniel Kriesten
2012-12-13 12:10     ` Daniel Kriesten
2012-12-14 10:18       ` Michael Olbrich
2012-12-14 12:28         ` Daniel Kriesten

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox