Re: errata: Explicit variables declaration statements do not resolve back-references from same statement

2019-07-24 Thread Chet Ramey
On 7/24/19 2:06 PM, Léa Gris wrote: > Found this strange behavior difference in Bash, between explicit and > implicit declarations of variables. It's not that strange. > An implicit variables declaration statement resolve back-references to > variables from the same statement. An assignment stat

Re: expression evaluation problem

2019-07-24 Thread Greg Wooledge
On Wed, Jul 24, 2019 at 11:43:11AM -0700, L A Walsh wrote: > Those aren't my variables. > If you assign the integer attribute to a variable it isn't the same > as when you don't. In this case it *is*, because everything is being fed to an arithmetic command anyway. Simplifying the bug report as m

Re: [PATCH] Fix \H: Use getaddrinfo to get full hostname

2019-07-24 Thread Chet Ramey
On 7/24/19 11:23 AM, Thomas Deutschmann wrote: > On 2019-07-24 16:46, Greg Wooledge wrote: >>> I hope you are not talking about putting FQDN into a file which is >>> expecting hostname only... >> >> Yes, many people do precisely that. They configure their systems >> so the "hostname" command retur

Re: expression evaluation problem

2019-07-24 Thread L A Walsh
On 2019/07/24 10:51, Greg Wooledge wrote: > On Wed, Jul 24, 2019 at 09:39:46AM -0700, L A Walsh wrote: > >> str='cf80' >> v=960 uxtra=1 c=0 >> > > Irrelevant alias shenanigans omitted. These are your variables. > Those aren't my variables. If you assign the integer attribute to a

Re: [PATCH] Fix \H: Use getaddrinfo to get full hostname

2019-07-24 Thread L A Walsh
On 2019/07/24 07:38, Thomas Deutschmann wrote: > Can you tell me more about your system and how you (your administrator) > set up your system so that hostname will return FQDN? > My linux box has 2 interfaces, internal & external, with different domain names on each. While hostname and hostname

errata: Explicit variables declaration statements do not resolve back-references from same statement

2019-07-24 Thread Léa Gris
Found this strange behavior difference in Bash, between explicit and implicit declarations of variables. An implicit variables declaration statement resolve back-references to variables from the same statement. Whereas: An explicit variables declaration statement does not resolve back-refer

Explicit variables declaration statements do not resolve back-references from same statement

2019-07-24 Thread Léa Gris
Found this strange behavior difference in Bash, between explicit and implicit declarations of variables. An implicit variables declaration statement resolve back-references to variables from the same statement. Whereas: An explicit variables declaration statement does not resolve back-refer

Re: expression evaluation problem

2019-07-24 Thread Greg Wooledge
On Wed, Jul 24, 2019 at 09:39:46AM -0700, L A Walsh wrote: > str='cf80' > v=960 uxtra=1 c=0 Irrelevant alias shenanigans omitted. These are your variables. > # In evaluating this expression: > ((v = v | ( uxtra>=++c ? ((0x${str:2*c:2}) & 63) << (6*(uxtra-c)) : 0 ))) > > > I get 985 and not

Re: [PATCH] Fix \H: Use getaddrinfo to get full hostname

2019-07-24 Thread Thomas Deutschmann
On 2019-07-24 17:32, Greg Wooledge wrote: > Your perspective is too limited. Linux-based systems are very popular, > but they're not the entire Unix world. > > [...] > > There is nothing "wrong" about this configuration. I don't like it, > and you clearly don't like it, but our opinions only ma

expression evaluation problem

2019-07-24 Thread L A Walsh
shopt -o expand_aliases my=declare int='my -i' my str='cf80' int v=960 uxtra=1 c=0 # In evaluating this expression: ((v = v | ( uxtra>=++c ? ((0x${str:2*c:2}) & 63) << (6*(uxtra-c)) : 0 ))) I get 985 and not 960 as expected Which only happens when 'c' is 0 in the middle 'str' expression,

Re: [PATCH] Fix \H: Use getaddrinfo to get full hostname

2019-07-24 Thread Greg Wooledge
On Wed, Jul 24, 2019 at 05:23:27PM +0200, Thomas Deutschmann wrote: > On 2019-07-24 16:46, Greg Wooledge wrote: > >> I hope you are not talking about putting FQDN into a file which is > >> expecting hostname only... > > > > Yes, many people do precisely that. They configure their systems > > so t

Re: [PATCH] Fix \H: Use getaddrinfo to get full hostname

2019-07-24 Thread Thomas Deutschmann
On 2019-07-24 16:46, Greg Wooledge wrote: >> I hope you are not talking about putting FQDN into a file which is >> expecting hostname only... > > Yes, many people do precisely that. They configure their systems > so the "hostname" command returns an FQDN, as I showed above. (Not > my design, not

Re: [PATCH] Fix \H: Use getaddrinfo to get full hostname

2019-07-24 Thread Greg Wooledge
On Wed, Jul 24, 2019 at 04:38:06PM +0200, Thomas Deutschmann wrote: > Can you tell me more about your system and how you (your administrator) > set up your system so that hostname will return FQDN? It's common outside the Linux world. # hostname minea.eeg.ccf.org # uname -a HP-UX minea B.11.11 U

Re: [PATCH] Fix \H: Use getaddrinfo to get full hostname

2019-07-24 Thread Chet Ramey
On 7/24/19 10:38 AM, Thomas Deutschmann wrote: > On 2019-07-24 16:27, Chet Ramey wrote: >> Thanks for the patch. This is system-dependent: there are systems, like >> mine, where `hostname' returns the system's FQDN. It all depends on the >> administrator's choices. > > Can you tell me more about y

Re: [PATCH] Fix \H: Use getaddrinfo to get full hostname

2019-07-24 Thread Thomas Deutschmann
On 2019-07-24 16:27, Chet Ramey wrote: > Thanks for the patch. This is system-dependent: there are systems, like > mine, where `hostname' returns the system's FQDN. It all depends on the > administrator's choices. Can you tell me more about your system and how you (your administrator) set up your

Re: [PATCH] Fix \H: Use getaddrinfo to get full hostname

2019-07-24 Thread Chet Ramey
On 7/24/19 9:58 AM, Thomas Deutschmann wrote: > At the moment, \h and \H used in prompt PS1 or PS2 will actually return > the same value while manpage claims that \h should return hostname up to > the first '.' (like `hostname`) and \H should return full hostname (like > `hostname -f`). Thanks for

[PATCH] Fix \H: Use getaddrinfo to get full hostname

2019-07-24 Thread Thomas Deutschmann
At the moment, \h and \H used in prompt PS1 or PS2 will actually return the same value while manpage claims that \h should return hostname up to the first '.' (like `hostname`) and \H should return full hostname (like `hostname -f`). This commit will make bash use the same API like hostname comman

Re: leaks fd for internal functions but not external command

2019-07-24 Thread Sam Liddicott
Thanks for that thoughtful response. * I understand that the design decision is to have variable file descriptors to stay open after per-command redirection * I understand that implementation constraints make it impossible to do this uniformly (for external command redirection) * I understand that