Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Dec 2007 17:40:20 +0100 (CET)
From:      Bjoern Koenig <bkoenig@alpha-tierchen.de>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/118782: shar sometimes creates broken archives
Message-ID:  <20071217164020.0E2C428689@home.alpha-tierchen.de>
Resent-Message-ID: <200712171650.lBHGo1ur059375@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         118782
>Category:       bin
>Synopsis:       shar sometimes creates broken archives
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 17 16:50:01 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator:     Bjoern Koenig
>Release:        affects all releases
>Organization:
>Environment:


	
>Description:
	The shar(1) utility creates EOF markers from the pathname
	of a file. The length EOF markers are restricted to 79
	bytes by sh(1). If the length of the EOF marker created
	by shar exceeds this limit then you'll get an error while
	extracting the archive:

		Syntax error: Illegal eof marker for << redirection
	
>How-To-Repeat:
	$ mkdir -p this/is/a/long/path/name/for/demonstration/of/a/bug
	$ echo test > this/is/a/long/path/name/for/demonstration/of/a/bug/and-this-is-a-filename
	$ shar `find this -type f` > archive
	$ sh archive
	x - this/is/a/long/path/name/for/demonstration/of/a/bug/and-this-is-a-filename
	archive: 11: Syntax error: Illegal eof marker for << redirection

>Fix:

	I do not provide a patch yet since there are several solutions which
	should be discussed:

	a) increase EOFMARKLEN in src/bin/sh/parser.c
		This won't actually solve the problem, but shifts it away if
		EOFMARKLEN is reasonable large enough.

	b) change sh that it doesn't restrict length of the EOF marker
		This is possible and in my opinion most elegant.

	c) change shar to respect the limitation of sh
		This is almost unjustifiable, because the shar utility is an
		incredibly simple shell script and this solution requires to
		add complex code.

	d) add a small notice to the BUGS section of shar's manpage
		Suggest also to use another shell code interpreter
		to extract the archive, e.g. bash.

	Choose one!
	
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071217164020.0E2C428689>