1 两个目录:test/a.c test_new/{a.c, abc/abc.c} //test_new下有a.c以及abc目录(目录下有abc.c文件)
2 我原以为打补丁不成功是权限问题,所以更改权限
chmod -R 0775 test test_new
3 制作补丁文件
diff -Naur test test_new > test.patch
修改test.patch权限为0777也不行
4 打补丁
打印信息:
The next patch would create the file test_new/abc/abc.c,
which already exists! Assume -R? [n] n
Apply anyway? [n] n
Skipping patch.
1 out of 1 hunk ignored
patching file test_new/abc/abc.c
Hunk #1 FAILED at 1 (different line endings).
1 out of 1 hunk FAILED -- saving rejects to file test_new/abc/abc.c.rej
abc.c.rej:
1 --- test/abc/abc.c 1970-01-01 08:00:00.000000000 +0800
2 +++ test_new/abc/abc.c 2016-02-25 09:14:58.834541600 +0800
3 @@ -0,0 +1,13 @@
4 +#include ^M
5 +#include ^M
6 +^M
7 +int main(void)^M
8 +{ ^M
9 + int i = 0;^M
10 + int sum = 0^M
11 + while(i++ < 10){^M
12 + sum += i;^M
13 + }^M
14 +^M
15 + printf("sum = %d\n", sum);^M
16 +}
尝试在test_new目录下新建一个b.c,打补丁时同样报上面信息,无法成功打补丁