Mailing List Archive

pilot-link & patching
I am following the instructions on teh forums for applying a patch to an
ebuild. The ebuild files have been moved to /usr/local/portage, where I have
other successfull custom ebuilds. The ebuild itself is deited to apply the
patch, but I do not understand the actual poatch does not seem to comply with
Gentoos patchine scheme or something. Here is the error I get.

>>> emerge (1 of 1) app-pda/pilot-link-0.11.8-r1 to /
>>> md5 src_uri ;-) pilot-link-0.11.8.tar.bz2
>>> Unpacking source...
>>> Unpacking pilot-link-0.11.8.tar.bz2
to /var/tmp/portage/pilot-link-0.11.8-r1/work
* Applying pilot-link-0.11.8-net_tickle_patch.patch...

* Failed Patch: pilot-link-0.11.8-net_tickle_patch.patch!
*
* Include in your bugreport the contents of:
*
* /var/tmp/portage/pilot-link-0.11.8-r1/temp/pilot-link-0.11.8-net_tickle_patch.patch-30635.out


!!! ERROR: app-pda/pilot-link-0.11.8-r1 failed.
!!! Function epatch, Line 400, Exitcode 0
!!! Failed Patch: pilot-link-0.11.8-net_tickle_patch.patch!
!!! If you need support, post the topmost build error, NOT this status
message.

chiefnb ~ #

Here is the patch itself
*******************************************************************************************

This fixes a bug where a tickle sent by the other end would
cause net_rx to return prematurely. This bug showed itself in
pi-nredir: when the server sent a tickle to pi-nredir, net_rx in
pi-nredir returned zero because it had received a zero-length packet;
but when net_rx returns zero that means the connection has been
closed, so pi-nredir exited.

*** net.c 2004/03/13 18:52:43 1.1
--- net.c 2004/03/13 19:54:13
***************
*** 179,187 ****
bytes = next->write(ps, buf, PI_NET_HEADER_LEN, flags);
if (bytes < PI_NET_HEADER_LEN)
return bytes;
! bytes = next->write(ps, msg, len, flags);
! if (bytes < len)
return bytes;

CHECK(PI_DBG_NET, PI_DBG_LVL_INFO, net_dump_header(buf, 1));
CHECK(PI_DBG_NET, PI_DBG_LVL_DEBUG, dumpdata(msg, len));
--- 179,189 ----
bytes = next->write(ps, buf, PI_NET_HEADER_LEN, flags);
if (bytes < PI_NET_HEADER_LEN)
return bytes;
! if (len > 0) { /* avoid zero-length write on tickle */
! bytes = next->write(ps, msg, len, flags);
! if (bytes < len)
return bytes;
+ }

CHECK(PI_DBG_NET, PI_DBG_LVL_INFO, net_dump_header(buf, 1));
CHECK(PI_DBG_NET, PI_DBG_LVL_DEBUG, dumpdata(msg, len));
***************
*** 196,202 ****
total_bytes,
packet_len,
timeout,
! size;

struct pi_protocol *prot, *next;
struct pi_net_data *data;
--- 198,205 ----
total_bytes,
packet_len,
timeout,
! size,
! done;

struct pi_protocol *prot, *next;
struct pi_net_data *data;
***************
*** 216,255 ****
pi_setsockopt(ps->sd, PI_LEVEL_DEV, PI_DEV_TIMEOUT,
&timeout, &size);

! total_bytes = 0;
! if (data->txid == 0) {
/* Peek to see if it is a headerless packet */
bytes = next->read(ps, msg, 1, flags);
if (bytes > 0) {
! LOG ((PI_DBG_NET, PI_DBG_LVL_INFO,
! "NET RX: Checking for headerless packet %d\n", msg[0]));

! if (msg[0] == 0x90) {
! /* Cause the header bytes to be skipped */
! LOG ((PI_DBG_NET, PI_DBG_LVL_INFO,
! "NET RX: Headerless packet\n"));
! total_bytes = PI_NET_HEADER_LEN;
! msg[PI_NET_OFFSET_TYPE] = PI_NET_TYPE_DATA;
! msg[PI_NET_OFFSET_TXID] = 0x01;
! set_long (&msg[PI_NET_OFFSET_SIZE], 21);
! } else {
! total_bytes += bytes;
! }
} else {
! return bytes;
}
! }

! /* Bytes in what's left of the header */
! while (total_bytes < PI_NET_HEADER_LEN) {
bytes = next->read(ps, msg + total_bytes, PI_NET_HEADER_LEN - total_bytes,
flags);
if (bytes <= 0)
! return bytes;
total_bytes += bytes;
}

/* Bytes in the rest of the packet */
- packet_len = get_long(&msg[PI_NET_OFFSET_SIZE]);
while (total_bytes < PI_NET_HEADER_LEN + packet_len) {
bytes = next->read(ps, msg + total_bytes,
PI_NET_HEADER_LEN + packet_len - total_bytes, flags);
--- 219,278 ----
pi_setsockopt(ps->sd, PI_LEVEL_DEV, PI_DEV_TIMEOUT,
&timeout, &size);

! done = 0;
! while (!done) {
! total_bytes = 0;
! if (data->txid == 0) {
/* Peek to see if it is a headerless packet */
bytes = next->read(ps, msg, 1, flags);
if (bytes > 0) {
! LOG ((PI_DBG_NET, PI_DBG_LVL_INFO,
! "NET RX: Checking for headerless packet %d\n", msg[0]));

! if (msg[0] == 0x90) {
! /* Cause the header bytes to be skipped */
! LOG ((PI_DBG_NET, PI_DBG_LVL_INFO,
! "NET RX: Headerless packet\n"));
! total_bytes = PI_NET_HEADER_LEN;
! msg[PI_NET_OFFSET_TYPE] = PI_NET_TYPE_DATA;
! msg[PI_NET_OFFSET_TXID] = 0x01;
! set_long (&msg[PI_NET_OFFSET_SIZE], 21);
! } else {
! total_bytes += bytes;
! }
} else {
! return bytes;
}
! }

! /* Bytes in what's left of the header */
! while (total_bytes < PI_NET_HEADER_LEN) {
bytes = next->read(ps, msg + total_bytes, PI_NET_HEADER_LEN - total_bytes,
flags);
if (bytes <= 0)
! return bytes;
total_bytes += bytes;
+ }
+ packet_len = get_long(&msg[PI_NET_OFFSET_SIZE]);
+ data->type = msg[PI_NET_OFFSET_TYPE];
+ switch (data->type) {
+ case PI_NET_TYPE_TCKL:
+ if (packet_len != 0) {
+ LOG ((PI_DBG_NET, PI_DBG_LVL_ERR,
+ "NET RX: tickle packet with non-zero length\n"));
+ return -1;
+ }
+ /* valid tickle packet; continue reading. */
+ break;
+ case PI_NET_TYPE_DATA:
+ done = 1;
+ break;
+ default:
+ LOG ((PI_DBG_NET, PI_DBG_LVL_ERR,
+ "NET RX: Unknown packet type\n"));
+ }
}

/* Bytes in the rest of the packet */
while (total_bytes < PI_NET_HEADER_LEN + packet_len) {
bytes = next->read(ps, msg + total_bytes,
PI_NET_HEADER_LEN + packet_len - total_bytes, flags);
*******************************************************************************************

I have looked at other patch files and they are not quite like this, anyone
know how to fix it?

Thanks,
Mike
--
Michael W. Holdeman

Powered by Gentoo Linux www.gentoo.org 2004.0
Kernel 2.6.7-win4lin-r3
Windows apps thanks to Win4Lin 5.1.16 netraverse.com
Wireless thanks to ndiswrapper

--
gentoo-user@gentoo.org mailing list