← Back to team overview

touch-packages team mailing list archive

[Bug 1409112] [NEW] echo adds period at beginning of line with \t in conjunction with bash newline \ character

 

Public bug reported:

Original text:
<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	ServerName ci.company.com
	ServerAlias ci
	ProxyRequests Off
	<Proxy *>
		Order deny,allow
		Allow from all
	</Proxy>
	ProxyPreserveHost on
	ProxyPass / http://localhost:8080/ nocanon
	AllowEncodedSlashes NoDecode
</VirtualHost>

Bash example with \ delineation:
echo -e "<VirtualHost *:80> \n\
	\tServerAdmin webmaster@localhost \n\
	\tServerName ci.company \n\
	\tServerAlias ci \n\
	\tProxyRequests Off \n\
	\t<Proxy *> \n\
		\t\tOrder deny,allow \n\
		\t\tAllow from all \n\
	\t</Proxy> \n\
	\tProxyPreserveHost on \n\
	\tProxyPass / http://localhost:8080/ nocanon \n\
	\tAllowEncodedSlashes NoDecode \n\
</VirtualHost>" >> /etc/apache2/sites-available/jenkins.conf

Output:
<VirtualHost *:80> 
.	ServerAdmin webmaster@localhost 
.	ServerName ci.company.com 
.	ServerAlias ci
.	ProxyRequests Off 
.	<Proxy *> 
.		Order deny,allow 
.		Allow from all 
.	</Proxy> 
.	ProxyPreserveHost on 
.	ProxyPass / http://localhost:8080/ nocanon 
.	AllowEncodedSlashes NoDecode 
</VirtualHost>

However, when combined on one line, like this:
echo -e "<VirtualHost *:80> \n\tServerAdmin webmaster@localhost \n\tServerName ci.company.com \n\tServerAlias ci \n\tProxyRequests Off \n\t<Proxy *> \n\t\tOrder deny,allow \n\t\tAllow from all \n\t</Proxy> \n\tProxyPreserveHost on \n\tProxyPass / http://localhost:8080/ nocanon \n\tAllowEncodedSlashes NoDecode \n</VirtualHost>"

The output looks like this:
<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	ServerName ci.company.com
	ServerAlias ci
	ProxyRequests Off
	<Proxy *>
		Order deny,allow
		Allow from all
	</Proxy>
	ProxyPreserveHost on
	ProxyPass / http://localhost:8080/ nocanon
	AllowEncodedSlashes NoDecode
</VirtualHost>

I believe this to be a bug with the echo() functionality. When used on
one line, there is no period proceeding the horizontal tab delineation.
However, when the echo function crosses multiple lines due to bash
readability with the \ character, it places a period at the beginning of
the line, before the tab delineation.

build@jenkins-master:~$ lsb_release -rd
Description:	Ubuntu 14.04.1 LTS
Release:	14.04

build@jenkins-master:~$ apt-cache policy coreutils
coreutils:
  Installed: 8.21-1ubuntu5
  Candidate: 8.21-1ubuntu5
  Version table:
 *** 8.21-1ubuntu5 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status

build@jenkins-master:~$ apt-cache policy bash
bash:
  Installed: 4.3-7ubuntu1.5
  Candidate: 4.3-7ubuntu1.5
  Version table:
 *** 4.3-7ubuntu1.5 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
        100 /var/lib/dpkg/status
     4.3-6ubuntu1 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

** Affects: coreutils (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to coreutils in Ubuntu.
https://bugs.launchpad.net/bugs/1409112

Title:
  echo adds period at beginning of line with \t in conjunction with bash
  newline \ character

Status in coreutils package in Ubuntu:
  New

Bug description:
  Original text:
  <VirtualHost *:80>
  	ServerAdmin webmaster@localhost
  	ServerName ci.company.com
  	ServerAlias ci
  	ProxyRequests Off
  	<Proxy *>
  		Order deny,allow
  		Allow from all
  	</Proxy>
  	ProxyPreserveHost on
  	ProxyPass / http://localhost:8080/ nocanon
  	AllowEncodedSlashes NoDecode
  </VirtualHost>

  Bash example with \ delineation:
  echo -e "<VirtualHost *:80> \n\
  	\tServerAdmin webmaster@localhost \n\
  	\tServerName ci.company \n\
  	\tServerAlias ci \n\
  	\tProxyRequests Off \n\
  	\t<Proxy *> \n\
  		\t\tOrder deny,allow \n\
  		\t\tAllow from all \n\
  	\t</Proxy> \n\
  	\tProxyPreserveHost on \n\
  	\tProxyPass / http://localhost:8080/ nocanon \n\
  	\tAllowEncodedSlashes NoDecode \n\
  </VirtualHost>" >> /etc/apache2/sites-available/jenkins.conf

  Output:
  <VirtualHost *:80> 
  .	ServerAdmin webmaster@localhost 
  .	ServerName ci.company.com 
  .	ServerAlias ci
  .	ProxyRequests Off 
  .	<Proxy *> 
  .		Order deny,allow 
  .		Allow from all 
  .	</Proxy> 
  .	ProxyPreserveHost on 
  .	ProxyPass / http://localhost:8080/ nocanon 
  .	AllowEncodedSlashes NoDecode 
  </VirtualHost>

  However, when combined on one line, like this:
  echo -e "<VirtualHost *:80> \n\tServerAdmin webmaster@localhost \n\tServerName ci.company.com \n\tServerAlias ci \n\tProxyRequests Off \n\t<Proxy *> \n\t\tOrder deny,allow \n\t\tAllow from all \n\t</Proxy> \n\tProxyPreserveHost on \n\tProxyPass / http://localhost:8080/ nocanon \n\tAllowEncodedSlashes NoDecode \n</VirtualHost>"

  The output looks like this:
  <VirtualHost *:80>
  	ServerAdmin webmaster@localhost
  	ServerName ci.company.com
  	ServerAlias ci
  	ProxyRequests Off
  	<Proxy *>
  		Order deny,allow
  		Allow from all
  	</Proxy>
  	ProxyPreserveHost on
  	ProxyPass / http://localhost:8080/ nocanon
  	AllowEncodedSlashes NoDecode
  </VirtualHost>

  I believe this to be a bug with the echo() functionality. When used on
  one line, there is no period proceeding the horizontal tab
  delineation. However, when the echo function crosses multiple lines
  due to bash readability with the \ character, it places a period at
  the beginning of the line, before the tab delineation.

  build@jenkins-master:~$ lsb_release -rd
  Description:	Ubuntu 14.04.1 LTS
  Release:	14.04

  build@jenkins-master:~$ apt-cache policy coreutils
  coreutils:
    Installed: 8.21-1ubuntu5
    Candidate: 8.21-1ubuntu5
    Version table:
   *** 8.21-1ubuntu5 0
          500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
          100 /var/lib/dpkg/status

  build@jenkins-master:~$ apt-cache policy bash
  bash:
    Installed: 4.3-7ubuntu1.5
    Candidate: 4.3-7ubuntu1.5
    Version table:
   *** 4.3-7ubuntu1.5 0
          500 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
          500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
          100 /var/lib/dpkg/status
       4.3-6ubuntu1 0
          500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/1409112/+subscriptions


Follow ups

References