Re: librsync stream interface
Martin Pool <[email protected]> Wed, 10 Jun 2015 04:19:00 +0000
| Newsgroups | gmane.network.librsync.general |
|---|---|
| Message-ID | <CAA9uavDvg1MKDvwGu9Dp5mVOcFaDQ85DLcVh_yB5MRFZ409CUg@mail.gmail.com> |
--===============2583698157730099851== Content-Type: multipart/alternative; boundary=047d7b15abe943ba870518222df1 --047d7b15abe943ba870518222df1 Content-Type: text/plain; charset=UTF-8 It's not obvious to me from your description what you're doing wrong. I think you need to run this in a debugger and see where specifically it's crashing. On Sun, Jun 7, 2015 at 10:01 AM Denis Corbin <[email protected]> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi, > > I get a strange behavior trying to mimic what rs_loadsig_file() then > rs_delta_file() but replacing the call to rs_whole_run() by an > equivalent routing relying on rs_job_iter() in place of rs_job_drive(). > > rs_signature_t *sumset = NULL; > rs_job_t *job = rs_loadsig_begin(&sumset); > rs_buffers_t buf; > > /* in a loop feeding buf with data */ > res = rs_job_iter(job, &buf); > /* then and extracting next_out/avail_out */ > > rs_job_free(job); > > first cycle: > - - feeding 24 bytes in avail_in/next_in > - - getting RS_BLOCKED as returned value, no data in next_out/avail_out > > second cycle: > - - feeding 0 bytes and setting eof_in > - - getting RS_DONE as returned value from rs_job_iter(). > and no data in next_out/avail_out as expected. > > So far so good! > > I got the signature in memory pointed to by sumset. The problem occurs > when I try to perform the delta, just the job creation differs: > > job = rs_delta_begin(sumset); > > /* in a loop feeding buf with data */ > res = rs_job_iter(job, &buf); > /* then and extracting next_out/avail_out */ > > first cycle: > - - I feed 33 bytes in next_in/avail_in > - - I get 4 bytes in next_out/avail_out > with RS_BLOCKED returned by rs_job_iter() > and all avail_in bytes have been consumed > > second cycle: > - - I feed 0 bytes in next_in/avail_in (reached EOF) and thus set eof_in > to 1 > - - next_out points to a valid pointer with avail_out set to the > allocated memory, I've double checked. > > calling rs_job_iter() then halts the program with the following error: > > Program received signal SIGSEGV, Segmentation fault. > 0x00007ffff7bd6050 in rs_search_for_block () from > /usr/lib/x86_64-linux-gnu/librsync.so.1 > > What did I do wrong? > > Cheers, > Denis. > > > On 01/06/2015 20:43, Denis Corbin wrote : > > On 01/06/2015 02:02, Martin Pool wrote: > >> Have a look at the implementation of rs_loadsig_file, which shows > >> that you construct a new job with rs_loadsig_begin, then feed > >> data into it. > > > > OK, good idea, > > > > > >> You can do this either through rs_job_drive which will call back > >> to you, or by establishing your own callbacks then calling > >> rs_job_iter. > > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.12 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iQIVAwUBVXR47QgxsL0D2LGCAQLwehAAgLN9Jupwh12zRdreQ+b2h8r5T6b4sLJJ > 3DsjGg4jvaTa2WOYGYaALl/qqBJ35ua1C/kQUMOl/pRXmGh8w++5XmZrJuidv7rX > mzC4o//5zl/pc+1jI4JgZp5mU3BNimYwYoswONeON//d/eS7rN2wFObyAsvbSZYd > UGuRddBDR/sDDdaIP99oQHX5DxpWwCZpXez/6HdWXsgbjUb8PfDbMNb3U47bM8Om > HpfYo7sd9CEtmPu3TH514aERZPp74PMgJT3pSoRj7FU3p382f/feAUNl+ni8kPdP > krO5R6o+N//emMiMBEYbsgejfOEsNZdPYKlLDU9S6xsZn5cuuogn2OWWocANM2az > 1So/VV5PMaJ6S/IgOa7wxQffrImY5DEjh7cNuuMmt95vwF4zIdtbsFon6uWFu09U > AZj/GASnAcSVen9bp7tZunTMe1wZeFEGw6O9a72/t033Jq/hxPWrEoyKuB9tnY9b > MEjRRMlr+BtuknX7nQ7mX8EGT1TUPXOjneA6DPPG/MehpTsW+V1SQ3FNRFkiryFe > TZS9YstJS75tKMTQorVtqIPQQNluzvfffWY+tgA84Bucxd7DfovPbpCSl7IRd4ut > fu+BMMcMRG2q8/q+g/mnTSedIgLzcP5LmYAG++eFNPnpHw7WKnEbT5L0R67pC8Nu > W8JVsEtKYKo= > =skdK > -----END PGP SIGNATURE----- > > > ------------------------------------------------------------------------------ > _______________________________________________ > librsync-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/librsync-users > --047d7b15abe943ba870518222df1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">It's not obvious to me from your description what you&= #39;re doing wrong. I think you need to run this in a debugger and see wher= e specifically it's crashing.<br></div><br><div class=3D"gmail_quote"><= div dir=3D"ltr">On Sun, Jun 7, 2015 at 10:01 AM Denis Corbin <<a href=3D= "mailto:[email protected]">[email protected]</a>> wrote:<br></div><block= quote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc= solid;padding-left:1ex">-----BEGIN PGP SIGNED MESSAGE-----<br> Hash: SHA1<br> <br> Hi,<br> <br> I get a strange behavior trying to mimic what rs_loadsig_file() then<br> rs_delta_file() but replacing the call to rs_whole_run() by an<br> equivalent routing relying on rs_job_iter() in place of rs_job_drive().<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 rs_signature_t *sumset =3D NULL;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 rs_job_t *job =3D rs_loadsig_begin(&sumset)= ;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 rs_buffers_t buf;<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* in a loop feedin= g buf with data */<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 res =3D rs_job_iter(job, &buf);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* then and extract= ing next_out/avail_out */<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 rs_job_free(job);<br> <br> first cycle:<br> - - feeding 24 bytes in avail_in/next_in<br> - - getting RS_BLOCKED as returned value, no data in next_out/avail_out<br> <br> second cycle:<br> - - feeding 0 bytes and setting eof_in<br> - - getting RS_DONE as returned value from rs_job_iter().<br> =C2=A0 and no data in next_out/avail_out as expected.<br> <br> So far so good!<br> <br> I got the signature in memory pointed to by sumset. The problem occurs<br> when I try to perform the delta, just the job creation differs:<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 job =3D rs_delta_begin(sumset);<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* in a loop feedin= g buf with data */<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 res =3D rs_job_iter(job, &buf);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* then and extract= ing next_out/avail_out */<br> <br> first cycle:<br> - - I feed 33 bytes in next_in/avail_in<br> - - I get 4 bytes in next_out/avail_out<br> =C2=A0 with RS_BLOCKED returned by rs_job_iter()<br> =C2=A0 and all avail_in bytes have been consumed<br> <br> second cycle:<br> - - I feed 0 bytes in next_in/avail_in (reached EOF) and thus set eof_in<br= > to 1<br> - - next_out points to a valid pointer with avail_out set to the<br> allocated memory, I've double checked.<br> <br> calling rs_job_iter() then halts the program with the following error:<br> <br> Program received signal SIGSEGV, Segmentation fault.<br> 0x00007ffff7bd6050 in rs_search_for_block () from<br> /usr/lib/x86_64-linux-gnu/librsync.so.1<br> <br> What did I do wrong?<br> <br> Cheers,<br> Denis.<br> <br> <br> On 01/06/2015 20:43, Denis Corbin wrote :<br> > On 01/06/2015 02:02, Martin Pool wrote:<br> >> Have a look at the implementation of rs_loadsig_file, which shows<= br> >>=C2=A0 that you construct a new job with rs_loadsig_begin, then fee= d<br> >> data into it.<br> ><br> > OK, good idea,<br> ><br> ><br> >> You can do this either through rs_job_drive which will call back<b= r> >> to you, or by establishing your own callbacks then calling<br> >> rs_job_iter.<br> ><br> <br> -----BEGIN PGP SIGNATURE-----<br> Version: GnuPG v1.4.12 (GNU/Linux)<br> Comment: Using GnuPG with Mozilla - <a href=3D"http://enigmail.mozdev.org/"= target=3D"_blank">http://enigmail.mozdev.org/</a><br> <br> iQIVAwUBVXR47QgxsL0D2LGCAQLwehAAgLN9Jupwh12zRdreQ+b2h8r5T6b4sLJJ<br> 3DsjGg4jvaTa2WOYGYaALl/qqBJ35ua1C/kQUMOl/pRXmGh8w++5XmZrJuidv7rX<br> mzC4o//5zl/pc+1jI4JgZp5mU3BNimYwYoswONeON//d/eS7rN2wFObyAsvbSZYd<br> UGuRddBDR/sDDdaIP99oQHX5DxpWwCZpXez/6HdWXsgbjUb8PfDbMNb3U47bM8Om<br> HpfYo7sd9CEtmPu3TH514aERZPp74PMgJT3pSoRj7FU3p382f/feAUNl+ni8kPdP<br> krO5R6o+N//emMiMBEYbsgejfOEsNZdPYKlLDU9S6xsZn5cuuogn2OWWocANM2az<br> 1So/VV5PMaJ6S/IgOa7wxQffrImY5DEjh7cNuuMmt95vwF4zIdtbsFon6uWFu09U<br> AZj/GASnAcSVen9bp7tZunTMe1wZeFEGw6O9a72/t033Jq/hxPWrEoyKuB9tnY9b<br> MEjRRMlr+BtuknX7nQ7mX8EGT1TUPXOjneA6DPPG/MehpTsW+V1SQ3FNRFkiryFe<br> TZS9YstJS75tKMTQorVtqIPQQNluzvfffWY+tgA84Bucxd7DfovPbpCSl7IRd4ut<br> fu+BMMcMRG2q8/q+g/mnTSedIgLzcP5LmYAG++eFNPnpHw7WKnEbT5L0R67pC8Nu<br> W8JVsEtKYKo=3D<br> =3DskdK<br> -----END PGP SIGNATURE-----<br> <br> ---------------------------------------------------------------------------= ---<br> _______________________________________________<br> librsync-users mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">l= [email protected]</a><br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/librsync-users" tar= get=3D"_blank">https://lists.sourceforge.net/lists/listinfo/librsync-users<= /a><br> </blockquote></div> --047d7b15abe943ba870518222df1-- --===============2583698157730099851== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ --===============2583698157730099851== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ librsync-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/librsync-users --===============2583698157730099851==--