On Fri, Oct 3, 2008 at 10:21 AM, David A. Case <case.biomaps.rutgers.edu> wrote:
> On Fri, Oct 03, 2008, Gustavo Seabra wrote:
>
>> > Does anyone know how to make a patch file that adds a file (rather than
>> > updating an existing file?)
>>
>> I think that's useful for everyone here:
>>
>> You can create a patch that creates a new file by diffing the
>> /dev/null with the file you want to create. For example:
>>
>> $ mkdir test
>> $ cd test
>> $ echo "this is the test file" > test_file
>> $ diff -Naur /dev/null test_file > patch1
>
> Just a note: this seems to work on Linux but not on cygwin. It could be that
> cygwin's handling of /dev/null is not really compatible with Linux/POSIX.
> Or maybe some problem with its patch.
>
> Note that Voldymyr's proposed solution also fails on cygwin. As with
> Gustavo's proposal, patch just says "can't file file to patch..." when it sees
> either /dev/null or a nonexistent file name.
>
> Cygwin's patch version is 2.5.8, whereas my Linux boxes seem to have 2.5.4.
> Not sure if this is relevant or not.
>
> ...dac
>
Weird... it works just fine for me. What's your 'diff' version? I'm
using Cygwin 1.5.25-15, and:
$ diff -v
diff (GNU diffutils) 2.8.7
$ patch -v
patch 2.5.8
(I can send you a cygcheck output if you want)
Cheers,
Gustavo.
Received on Sun Oct 05 2008 - 05:07:31 PDT