Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Creating a patch problem (newbie question again)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Vanquirius
Retired Dev
Retired Dev


Joined: 14 Jun 2002
Posts: 1297
Location: Ethereal plains

PostPosted: Thu Jul 10, 2003 6:45 pm    Post subject: Creating a patch problem (newbie question again) Reply with quote

Hello,

I thought I had fixed this, but it turns out I didn't...

I modified a file called piozone.c (from a program called piozone, http://www2.lysator.liu.se/~pen/piozone/ ) and changed all llseek() functions for lseek64(), and added a definition at the top (#define uint64_t u_int64_t).
The modifications work fine. I am able to successfully create a diff file using
diff -ur piozone-1.0.orig/piozone.c piozone-1.0/piozone.c, which yields

Code:

diff -ur piozone-1.0.orig/piozone.c piozone-1.0/piozone.c
--- piozone-1.0.orig/piozone.c  2003-07-10 14:46:04.000000000 -0300
+++ piozone-1.0/piozone.c       2003-07-10 14:48:44.000000000 -0300
@@ -20,7 +20,7 @@
 #include <fcntl.h>
 #include <time.h>
 #include <signal.h>
-
+#define uint64_t u_int64_t
 #define KiB ((uint64_t) 1024)
 #define MiB ((uint64_t) 1024*KiB)
 #define GiB ((uint64_t) 1024*MiB)
@@ -73,7 +73,7 @@
     int count = 0;
     int nr = 0;

-    llseek(fd, off, SEEK_SET);
+    lseek64(fd, off, SEEK_SET);
     signal(SIGALRM, sigalrm_handler);
     stopf = 0;
     printf("Testing... ");
@@ -121,7 +121,7 @@
     printf("Testing... ");
     alarm(ts);
     while (!stopf &&
-          llseek(fd, off+((rand()&area)*MiB), SEEK_SET) != -1 &&
+          lseek64(fd, off+((rand()&area)*MiB), SEEK_SET) != -1 &&
           (nr = read(fd, iobuf, len)) == len)
     {
        print_dial();


However, when I try to apply the patch to the original file with
Code:

patch -p1 < piozone-1.0-x86.diff


I get
Code:

patching file piozone.c
Hunk #2 FAILED at 73.
Hunk #3 FAILED at 121.
2 out of 3 hunks FAILED -- saving rejects to file piozone.c.rej


The "#define uint64_t u_int64_t" part gets patched fine, but the rest doesn't. Here's piozone.c.rej:

Code:

***************
*** 73,79 ****
      int count = 0;
      int nr = 0;
 
-     llseek(fd, off, SEEK_SET);
      signal(SIGALRM, sigalrm_handler);
      stopf = 0;
      printf("Testing... ");
--- 73,79 ----
      int count = 0;
      int nr = 0;
 
+     lseek64(fd, off, SEEK_SET);
      signal(SIGALRM, sigalrm_handler);
      stopf = 0;
      printf("Testing... ");
***************
*** 121,127 ****
      printf("Testing... ");
      alarm(ts);
      while (!stopf &&
-           llseek(fd, off+((rand()&area)*MiB), SEEK_SET) != -1 &&
            (nr = read(fd, iobuf, len)) == len)
      {
         print_dial();
--- 121,127 ----
      printf("Testing... ");
      alarm(ts);
      while (!stopf &&
+           lseek64(fd, off+((rand()&area)*MiB), SEEK_SET) != -1 &&
            (nr = read(fd, iobuf, len)) == len)
      {
         print_dial();


What am I doing wrong?
_________________
Hello.
Back to top
View user's profile Send private message
joycea
Apprentice
Apprentice


Joined: 23 Jul 2002
Posts: 191
Location: Kingston, Canada

PostPosted: Thu Jul 10, 2003 7:57 pm    Post subject: Reply with quote

I think you might have different directory levels, not very experienced with creating patches though. I found this, it may be worth reading, http://www.cpqlinux.com/patch.html
Back to top
View user's profile Send private message
Vanquirius
Retired Dev
Retired Dev


Joined: 14 Jun 2002
Posts: 1297
Location: Ethereal plains

PostPosted: Thu Jul 10, 2003 9:43 pm    Post subject: Reply with quote

Thanks for the help, but I am not sure if that's the case. I had both folders under /home/marcelo and inside each of them was "Makefile piozone.c version.c" (that's before compiling anything/make clean). No subfolders, though.

I'll try again using that site's walkthrough, it seems very complete.

edit: I followed the instructions from that site I got it working. Thank you very much.
_________________
Hello.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum