Thursday, February 24, 2011

Patches

In chapter 7 of the Teaching Open Source book, we are learning how to create, submit, and incorporate patches.  We are currently in the process of submitting our bug fix to the Sugar Labs project so this is timely. 

The first exercise was to note the differences when the -u option was used and not used in the patch command.  Here are the 2 commands and their outputs:

[megan.weaver@stono ~]$ diff hello.c.punct hello.c
6c6
<    printf("Hello, World.\n");
---
>    printf("Hello, World!\n");


[megan.weaver@stono ~]$ diff -u hello.c.punct hello.c
--- hello.c.punct       2011-02-23 13:11:09.000000000 -0500
+++ hello.c     2011-02-23 13:11:35.000000000 -0500
@@ -3,6 +3,6 @@
 #include <stdio.h>

 int main() {
-   printf("Hello, World.\n");
+   printf("Hello, World!\n");
    return 0;
 }

The -u command shows a lot more information in the output.

In the next exercise, we changed a file in core utilities and created a patch file from the differences.  The change was to the echo.c file.  The change resulted in the echoed string being reverse.

No comments:

Post a Comment