Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Jan 2002 23:21:36 -0500 (EST)
From:      Alan Eldridge <ports@geeksrus.net>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/34152: MAINTAINER UPDATE: add network timeout to grip, other minor fixes
Message-ID:  <200201220421.g0M4Lac07628@wwweasel.geeksrus.net>

next in thread | raw e-mail | index | archive | help

>Number:         34152
>Category:       ports
>Synopsis:       MAINTAINER UPDATE: add network timeout to grip, other minor fixes
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 21 20:30:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Alan Eldridge
>Release:        FreeBSD 4.4-STABLE i386
>Organization:
Geeksrus.NET
>Environment:
System: FreeBSD wwweasel.geeksrus.net 4.4-STABLE FreeBSD 4.4-STABLE #0: Sun Dec 2 19:14:12 EST 2001 root@wwweasel.geeksrus.net:/usr/obj/usr/src/sys/WWWEASEL i386

>Description:

1. Add a timeout to CDDB connect, so it won't hang forever.
2. Remove two patches that did nothing.
3. Fix misspellings of "psychedelic".
4. Change MASTER_SITE to MASTER_SITE_SOURCEFORGE, since SF has multiple
	download URLs.

Note 1: I had to remove the original site when I added MASTER_SITE_SOURCEFORGE,
because the md5sums don't match, although the untarred contents do.
Note 2: patch-ad, which was also removed, was folded into patch-grip.c.

Yes, I know 2.98.2 is out. I'm working on it. It's a major rewrite in
a lot of ways, so I won't be updating to it until I'm confident in it,
as it is requiring some work to make a port.

>How-To-Repeat:

>Fix:

Index: audio/grip/Makefile
===================================================================
RCS file: /home/alane/cvsroot/ports/audio/grip/Makefile,v
retrieving revision 1.9
diff -u -3 -r1.9 Makefile
--- audio/grip/Makefile	20 Jan 2002 22:23:54 -0000	1.9
+++ audio/grip/Makefile	22 Jan 2002 04:07:11 -0000
@@ -7,9 +7,10 @@
 
 PORTNAME=	grip
 PORTVERSION=	2.96
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	audio
-MASTER_SITES=	http://www.nostatic.org/grip/
+MASTER_SITES=	${MASTER_SITE_SOURCEFORGE} 
+MASTER_SITE_SUBDIR=grip
 EXTRACT_SUFX=	.tgz
 
 MAINTAINER=	ports@geeksrus.net
Index: audio/grip/distinfo
===================================================================
RCS file: /home/alane/cvsroot/ports/audio/grip/distinfo,v
retrieving revision 1.4
diff -u -3 -r1.4 distinfo
--- audio/grip/distinfo	20 Aug 2001 01:57:21 -0000	1.4
+++ audio/grip/distinfo	22 Jan 2002 04:07:25 -0000
@@ -1 +1 @@
-MD5 (grip-2.96.tgz) = 93bd9c4672a8d53daf32772812e624d8
+MD5 (grip-2.96.tgz) = 29d03b2874c5cb60096ac3051fbbc4e3
Index: audio/grip/files/patch-ab
===================================================================
RCS file: audio/grip/files/patch-ab
diff -N audio/grip/files/patch-ab
--- audio/grip/files/patch-ab	5 Sep 2000 01:33:44 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,10 +0,0 @@
---- grip.h.orig	Tue Apr 18 10:37:44 2000
-+++ grip.h	Mon Sep  4 17:59:26 2000
-@@ -257,6 +257,7 @@
- /* Low-level cd control routines -- found in cd.c */
- 
- int CDInitDevice(char *device_name);
-+void CDCloseDevice(int cd_desc);
- int CDStat(int cd_desc,struct disc_info *disc,gboolean read_toc);
- int CDPlayFrames(int cd_desc,int startframe,int endframe);
- int CDPlayTrackPos(int cd_desc,struct disc_info *disc,int starttrack,
Index: audio/grip/files/patch-ac
===================================================================
RCS file: audio/grip/files/patch-ac
diff -N audio/grip/files/patch-ac
--- audio/grip/files/patch-ac	5 Sep 2000 01:33:44 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,14 +0,0 @@
---- cd.c.orig	Tue Apr 18 10:37:44 2000
-+++ cd.c	Mon Sep  4 17:59:26 2000
-@@ -98,6 +98,11 @@
-   return cd_desc;
- }
- 
-+void CDCloseDevice(int cd_desc)
-+{
-+  close(cd_desc);
-+}
-+
- /* Update a CD status structure... because operating system interfaces vary
-    so does this function. */
- 
Index: audio/grip/files/patch-ad
===================================================================
RCS file: audio/grip/files/patch-ad
diff -N audio/grip/files/patch-ad
--- audio/grip/files/patch-ad	23 Oct 2000 19:51:17 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,29 +0,0 @@
---- grip.c.orig	Thu Oct 19 04:12:53 2000
-+++ grip.c	Fri Oct 20 20:55:01 2000
-@@ -314,7 +314,7 @@
- gboolean use_proxy=FALSE;
- gboolean use_proxy_env=FALSE;
- 
--char *bin_search_paths[]={"/cpd/misc/bin","/usr/bin","/usr/local/bin",NULL};
-+char *bin_search_paths[]={"/cpd/misc/bin","/usr/bin","%%LOCALBASE%%/bin",NULL};
- Ripper ripper_defaults[]={
- #ifdef CDPAR
-   {"grip (cdparanoia)",""},
-@@ -327,7 +327,7 @@
- #endif
-   {"other",""},
-   {"",""}};
--char ripexename[256]="/usr/bin/cdparanoia";
-+char ripexename[256]="%%LOCALBASE%%/bin/cdparanoia";
- char ripcmdline[256]="-d %c %t:[.%b]-%t:[.%e] %f";
- int selected_ripper=0;
- char outputdir[256];
-@@ -346,7 +346,7 @@
- gboolean disable_extra_paranoia=FALSE;
- gboolean disable_scratch_detect=FALSE;
- gboolean disable_scratch_repair=FALSE;
--char mp3exename[256]="/usr/bin/bladeenc";
-+char mp3exename[256]="%%LOCALBASE%%/bin/bladeenc";
- char mp3cmdline[256]="-%b -QUIT %f";
- int selected_encoder=1;
- char mp3fileformat[256]="~/mp3/%a/%d/%n.mp3";
Index: audio/grip/files/patch-cddb.c
===================================================================
RCS file: audio/grip/files/patch-cddb.c
diff -N audio/grip/files/patch-cddb.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ audio/grip/files/patch-cddb.c	22 Jan 2002 03:53:37 -0000
@@ -0,0 +1,160 @@
+--- cddb.c.orig	Mon Jul 16 12:15:32 2001
++++ cddb.c	Mon Jan 21 22:51:21 2002
+@@ -27,6 +27,9 @@
+ #include <strings.h>
+ #endif
+ #include <ctype.h>
++#include <fcntl.h>
++#include <pthread.h>
++#include <sys/time.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <sys/stat.h>
+@@ -43,7 +46,7 @@
+ extern char *Version;
+ 
+ static int CDDBSum(int val);
+-static int CDDBConnect(CDDBServer *server);
++static int CDDBConnect(CDDBServer *server, int ns);
+ static void CDDBDisconnect(int sock);
+ static void CDDBSkipHTTP(int sock);
+ static int CDDBReadLine(int sock,char *inbuffer,int len);
+@@ -59,6 +62,81 @@
+ 			    "data","folk","jazz","misc","newage",
+ 			    "reggae","rock","soundtrack"};
+ 
++/* nonblocking connect */
++
++static int
++nonbconnect(int fd, struct sockaddr *pa, socklen_t cba, int ns)
++{
++  int n;
++  int s;
++  int fl;
++  fd_set rfds, wfds;
++  struct timeval tv;
++
++  if (!ns) {
++    n = connect(fd, pa, cba);
++    pthread_testcancel();
++    return n;
++  }
++
++  fl = fcntl(fd, F_GETFL, 0);
++  fcntl(fd, F_SETFL, fl | O_NONBLOCK);
++
++  if ((n = connect(fd, pa, cba)) < 0) {
++    if (errno != EINPROGRESS) {
++      return -1;
++    }
++  } else if (n == 0) {
++    fcntl(fd, F_SETFL, fl);
++    return 0;
++  }
++
++
++  for (s = 0; s < ns; s++) {
++    tv.tv_sec = 1;
++    tv.tv_usec = 0;
++    FD_ZERO(&rfds);
++    FD_SET(fd, &rfds);
++    wfds = rfds;
++    if ((n = select(fd + 1, &rfds, &wfds, 0, &tv)) > 0) {
++      break;
++    } else if (n < 0) {
++      if (errno == EINTR) {
++        s--;
++      } else {
++        return -1;
++      }
++    }
++    pthread_testcancel();
++  }
++      
++  if (n == 0 && s == ns) {
++    errno = ETIMEDOUT;
++    return -1;
++  }
++
++  if (FD_ISSET(fd, &rfds) || FD_ISSET(fd, &wfds)) {
++    int err;
++    int cberr = sizeof(err);
++
++    getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &cberr);
++    if (err) {
++      errno = err;
++      return -1;
++    }
++    fcntl(fd, F_SETFL, fl);
++    tv.tv_sec = ns; 
++    tv.tv_usec = 0;
++    setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
++    return 0;
++  }
++
++  /* ohshit */
++
++  errno = EIO; /* WTF? */
++  return -1;
++}
++
+ /* CDDB sum function */
+ 
+ static int CDDBSum(int val)
+@@ -115,7 +193,7 @@
+ }
+ 
+ /* Connect to a CDDB server */
+-static int CDDBConnect(CDDBServer *server)
++static int CDDBConnect(CDDBServer *server, int ns)
+ {
+   int sock;
+   struct sockaddr_in sin;
+@@ -146,8 +224,10 @@
+ 
+   if((sock=socket(AF_INET,SOCK_STREAM,0))<0) return -1;
+   
+-  if(connect(sock,(struct sockaddr *)&sin,sizeof(sin))<0) return -1;
+-  
++  if(nonbconnect(sock,(struct sockaddr *)&sin,sizeof(sin),ns)<0) {
++    close(sock);
++    sock = -1;
++  }
+   return sock;
+ }
+ 
+@@ -243,7 +323,7 @@
+ /* Query the CDDB for the CD currently in the CD-ROM */
+ 
+ gboolean CDDBDoQuery(int cd_desc,CDDBServer *server,
+-		     CDDBHello *hello,CDDBQuery *query)
++		     CDDBHello *hello,CDDBQuery *query, int ns)
+ {
+   int socket;
+   int index;
+@@ -251,7 +331,7 @@
+   char *offset_buffer,*query_buffer,*http_buffer,inbuffer[256];
+   int tot_len,len;
+ 
+-  socket=CDDBConnect(server);
++  socket=CDDBConnect(server,ns);
+ 
+   if(socket==-1) return FALSE;
+ 
+@@ -476,14 +556,14 @@
+ 
+ gboolean CDDBRead(int cd_desc,CDDBServer *server,
+ 		  CDDBHello *hello,CDDBEntry *entry,
+-		  DiscData *data)
++		  DiscData *data, int ns)
+ {
+   int socket;
+   int index;
+   char outbuffer[256], inbuffer[512],cmdbuffer[256];
+   struct disc_info disc;
+   
+-  socket=CDDBConnect(server);
++  socket=CDDBConnect(server,ns);
+   if(socket==-1) return FALSE;
+   
+   CDStat(cd_desc,&disc,TRUE);
Index: audio/grip/files/patch-grip.c
===================================================================
RCS file: audio/grip/files/patch-grip.c
diff -N audio/grip/files/patch-grip.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ audio/grip/files/patch-grip.c	22 Jan 2002 04:03:38 -0000
@@ -0,0 +1,99 @@
+--- grip.c.orig	Mon Jul 16 12:15:32 2001
++++ grip.c	Mon Jan 21 23:03:30 2002
+@@ -54,6 +54,8 @@
+ #include "parsecfg.h"
+ #include "dialog/dialog.h"
+ 
++#define CDDB_USE_CANCEL 1
++
+ #ifdef CDPAR
+ #define size16 short
+ #define size32 int
+@@ -212,6 +214,8 @@
+ 
+ GdkCursor *wait_cursor;
+ 
++int cddb_tmo = 30;
++
+ int cd_desc;
+ int changer_slots;
+ int current_disc=0;
+@@ -315,7 +319,7 @@
+ gboolean use_proxy=FALSE;
+ gboolean use_proxy_env=FALSE;
+ 
+-char *bin_search_paths[]={"/cpd/misc/bin","/usr/bin","/usr/local/bin",NULL};
++char *bin_search_paths[]={"/cpd/misc/bin","/usr/bin","%%LOCALBASE%%/bin",NULL};
+ Ripper ripper_defaults[]={
+ #ifdef CDPAR
+   {"grip (cdparanoia)",""},
+@@ -328,7 +332,7 @@
+ #endif
+   {"other",""},
+   {"",""}};
+-char ripexename[256]="/usr/bin/cdparanoia";
++char ripexename[256]="%%LOCALBASE%%/bin/cdparanoia";
+ char ripcmdline[256]="-d %c %t:[.%b]-%t:[.%e] %f";
+ int selected_ripper=0;
+ char outputdir[256];
+@@ -347,7 +351,7 @@
+ gboolean disable_extra_paranoia=FALSE;
+ gboolean disable_scratch_detect=FALSE;
+ gboolean disable_scratch_repair=FALSE;
+-char mp3exename[256]="/usr/bin/bladeenc";
++char mp3exename[256]="%%LOCALBASE%%/bin/bladeenc";
+ char mp3cmdline[256]="-%b -QUIT %f";
+ int selected_encoder=1;
+ char mp3fileformat[256]="~/mp3/%a/%d/%n.mp3";
+@@ -450,7 +454,7 @@
+   "Instrumental Rock", "Ethnic", "Gothic", "Darkwave", "Techno-Industrial",
+   "Electronic", "Pop-Folk", "Eurodance", "Dream", "Southern Rock", "Comedy",
+   "Cult", "Gangsta", "Top 40", "Christian Rap", "Pop/Funk", "Jungle",
+-  "Native American", "Cabaret", "New Wave", "Psychadelic", "Rave", "Showtunes",
++  "Native American", "Cabaret", "New Wave", "Psychedelic", "Rave", "Showtunes",
+   "Trailer", "Lo-Fi", "Tribal", "Acid Punk", "Acid Jazz", "Polka", "Retro",
+   "Musical", "Rock & Roll", "Hard Rock", "Folk", "Folk/Rock", "National Folk",
+   "Swing", "Fast Fusion", "Bebob", "Latin", "Revival", "Celtic", "Bluegrass",
+@@ -1657,8 +1661,12 @@
+   pthread_exit(&status);
+ #elif defined(__FreeBSD__)
+   pthread_kill(cddb_thread, 0);
++#elif defined(linux)
++#if CDDB_USE_CANCEL
++  pthread_cancel(cddb_thread);
+ #else
+-    pthread_kill_other_threads_np();
++  pthread_kill_other_threads_np();
++#endif
+ #endif
+     Debug("Aborted\n");
+     looking_up=FALSE;
+@@ -1722,6 +1730,7 @@
+   int cddb_found = 0;
+ 
+   if(!CDDBLookupDisc(&dbserver)) {
++    pthread_testcancel();
+     if(*(dbserver2.name)) {
+       if(CDDBLookupDisc(&dbserver2)) {
+         cddb_found = 1;
+@@ -1759,9 +1768,10 @@
+   strncpy(hello.hello_program,PROGRAM,256);
+   strncpy(hello.hello_version,VERSION,256);
+ 	
+-  if(!CDDBDoQuery(cd_desc,server,&hello,&query)) {
++  if(!CDDBDoQuery(cd_desc,server,&hello,&query,cddb_tmo)) {
+     update_required=TRUE;
+   } else {
++    pthread_testcancel();
+     switch(query.query_match) {
+     case MATCH_INEXACT:
+     case MATCH_EXACT:
+@@ -1770,7 +1780,7 @@
+ 	     query.query_list[0].list_title);
+       entry.entry_genre = query.query_list[0].list_genre;
+       entry.entry_id = query.query_list[0].list_id;
+-      CDDBRead(cd_desc,server,&hello,&entry,&ddata);
++      CDDBRead(cd_desc,server,&hello,&entry,&ddata,cddb_tmo);
+ 		
+       Debug("Done\n");
+       success=TRUE;
Index: audio/grip/files/patch-grip.h
===================================================================
RCS file: audio/grip/files/patch-grip.h
diff -N audio/grip/files/patch-grip.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ audio/grip/files/patch-grip.h	22 Jan 2002 03:53:37 -0000
@@ -0,0 +1,18 @@
+--- grip.h.orig	Mon Jul 16 12:15:32 2001
++++ grip.h	Mon Jan 21 22:51:22 2002
+@@ -239,13 +239,10 @@
+ char *CDDBGenre(int genre);
+ int CDDBGenreValue(char *genre);
+ gboolean CDDBDoQuery(int cd_desc,CDDBServer *server,
+-		     CDDBHello *hello,CDDBQuery *query);
++		     CDDBHello *hello,CDDBQuery *query, int ns);
+ gboolean CDDBRead(int cd_desc,CDDBServer *server,
+ 		  CDDBHello *hello,CDDBEntry *entry,
+-		  DiscData *data);
+-gboolean CDDBRead(int cd_desc,CDDBServer *server,
+-		  CDDBHello *hello,CDDBEntry *entry,
+-		  DiscData *data);
++		  DiscData *data, int ns);
+ gboolean CDDBStatDiscData(int cd_desc);
+ int CDDBReadDiscData(int cd_desc, DiscData *outdata);
+ int CDDBWriteDiscData(int cd_desc,DiscData *ddata,FILE *outfile,

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201220421.g0M4Lac07628>