This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Script broken after updating bash to 4.3.46-7?


Looks like it's related to a recent change in bash, which is `read`
now honors Cygwin-specific `igncr` shell option (`set -o igncr`),
which I didn't enable.
Adding `set -o igncr` to the top of the script does the job, however
I'd like to know how many more scripts are potentially malfunctioning
now?
It's lucky that one sent e-mails on errors, some others might just
break silently.
Is it advisable to add `set -o igncr` to /etc/profile or SHELLOPTS? I
didn't use that feature before and am worried about some other
negative side effects.
--Gene

On 27 August 2016 at 02:49, Gene Pavlovsky <gene.pavlovsky@gmail.com> wrote:
> After I updated Cygwin yesterday, a daily database backup bash script
> (`automysqlbackup`) broke.
> My previous bash was 4.3.42-4 (installed when I updated Cygwin on
> 2016/07/23), current is 4.3.46-7.
> Here's the code snippet:
> ```bash
>   local i;i=0;
>   while read -r; do alldbnames[i++]="$REPLY"; done < <(mysql
> --user="${CONFIG_mysql_dump_username}"
> --password="${CONFIG_mysql_dump_password}"
> --host="${CONFIG_mysql_dump_host}" "${mysql_opt[@]}" --batch
> --skip-column-names -e "show databases")
> ```
> This is supposed to get the list of all databases. Before it worked.
> Now every item on the list ends with the CR character ($'\r'), causing
> a bunch of issues with further script opreation. I'm using official
> MariaDB Windows x64 binaries.
> Frankly if mysql does output CRLF line endings, I don't know why that
> script worked before, considering that this command in an interactive
> shell produces a similar result:
> ```bash
> # echo $'information_schema\r' | { read -r var; echo "{$var}"; }
> }information_schema
> ```
> But it did work somehow... Question is - what made it stop working
> now, and what would be best way to fix it?
>
> Regards,
> Gene.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]