Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Apr 2002 01:02:02 -0400
From:      Mike Barcroft <mike@FreeBSD.ORG>
To:        "M. Warner Losh" <imp@village.org>
Cc:        drosih@rpi.edu, arch@FreeBSD.ORG, freebsd-standards@FreeBSD.ORG
Subject:   Re: diff & patch problem with 'No newline'
Message-ID:  <20020426010202.E43192@espresso.q9media.com>
In-Reply-To: <20020425.221245.99497735.imp@village.org>; from imp@village.org on Thu, Apr 25, 2002 at 10:12:45PM -0600
References:  <20020425210035.A43192@espresso.q9media.com> <20020425.202217.82927028.imp@village.org> <20020426000849.C43192@espresso.q9media.com> <20020425.221245.99497735.imp@village.org>

next in thread | previous in thread | raw e-mail | index | archive | help
M. Warner Losh <imp@village.org> writes:
> In message: <20020426000849.C43192@espresso.q9media.com>
>             Mike Barcroft <mike@FreeBSD.ORG> writes:
> : Perhaps the people working on Subversion still have time to fix that
> : designo before too many people start using it.  Solaris 2.5.1, for
> : instance, returns "Warning: missing newline at end of file" on stderr
> : for this condition.
> 
> Subversion already powers through this by forcing the user to install
> gnu diff.

That'll teach them.

> What does POSIX.1 say about this matter?

Nothing about this specific case, but:

: STDOUT
: ...
: Diff Binary Output Format
: In the POSIX locale, if one or both of the files being compared are
: not text files, an unspecified format shall be used that contains the
: pathnames of two files being compared and the string "differ".
:
: If both files being compared are text files, depending on the options
: specified, one of the following formats shall be used to write the
: differences.
: ...

...where text file is defined as:

: 3.392 Text File                                                            
: 
: A file that contains characters organized into one or more lines.  The
: lines do not contain NUL characters and none can exceed {LINE_MAX}
: bytes in length, including the <newline>.  Although
: IEEE Std 1003.1-2001 does not distinguish between text files and
: files (see the ISO C standard), many utilities only produce
: predictable or meaningful output when operating on text files.  The
: standard utilities that have such restrictions always specify text
: files in their STDIN or INPUT FILES sections.

Since the Standard doesn't allow additional output on STDOUT (with
good reason, since it breaks patch), we have two ways to conform,
either take the Solaris way and utilize:

: STDERR
: The standard error shall be used only for diagnostic messages.

...or utilize the binary output option, which I recommend since I
don't consider files without trailing newlines to be text files.

Best regards,
Mike Barcroft

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




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