Bug#782096: QRQ: FTBFS on hurd-i386: PATH_MAX

2015-05-09 Thread Colin Tuckley
The patch attached to this bug report causes qrq to die immediately on
start-up on Linux systems.

All the changes involving OSS and Pulse Audio are nothing to do with the
Hurd FTBFS.

Patch rejected.

-- 
Colin Tuckley  |  +44(0)1223 830814  |  PGP/GnuPG Key Id
Debian Developer   |  +44(0)7799 143369  | 0x38C9D903


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#782096: QRQ: FTBFS on hurd-i386: PATH_MAX

2015-04-21 Thread mtang

Build using pulseaudio was omitted

Display corruption when using wgetc function.

Builds successfully using pulseaudio also.

see attached for patch--- qrq.c_original	2015-04-18 07:53:42.0 -0400
+++ qrq.c	2015-04-21 09:51:33.0 -0400
@@ -43,6 +43,8 @@
 #include windows.h
 #endif
 
+
+
 #define PI M_PI
 
 #define SILENCE 0		/* Waveforms for the tone generator */
@@ -63,17 +65,20 @@
 typedef void *AUDIO_HANDLE;
 #endif
 
-#ifdef OSS
+//#ifdef OSS
 #include oss.h
 #define write_audio(x, y, z) write(x, y, z)
 #define close_audio(x) close(x)
 typedef int AUDIO_HANDLE;
-#endif
+//#endif
 
-#ifdef PA
+/**
+ building with pulseaudio gives cookie error
+#ifdef PA   
 #include pulseaudio.h
 typedef void *AUDIO_HANDLE;
 #endif
+**/
 
 /* callsign array will be dynamically allocated */
 static char **calls = NULL;
@@ -86,10 +91,10 @@
 
 /* List of available callbase files. Probably no need to do dynamic memory allocation for that list */
 
-static char cblist[100][PATH_MAX];
+static char cblist[100][4096];  // need editing original cblist[100][PATH_MAX]
 
 static char mycall[15]=DJ1YFK;		/* mycall. will be read from qrqrc */
-static char dspdevice[PATH_MAX]=/dev/dsp;	/* will also be read from qrqrc */
+static char *dspdevice;	 /* will also be read from qrqrc */
 static int score = 0;	/* qrq score */
 static int sending_complete;			/* global lock for enter while sending */
 static int callnr = 0;	/* nr of actual call in attempt */
@@ -157,11 +162,11 @@
 pthread_attr_t cwattr;
 #endif
 
-char rcfilename[PATH_MAX]=;			/* filename and path to qrqrc */
-char tlfilename[PATH_MAX]=;			/* filename and path to toplist */
-char cbfilename[PATH_MAX]=;			/* filename and path to callbase */
+char *rcfilename;			/* filename and path to qrqrc */
+char *tlfilename;			/* filename and path to toplist */
+char *cbfilename;			/* filename and path to callbase */
 
-char destdir[PATH_MAX]=;
+char *destdir;
 
 
 /* create windows */
@@ -172,18 +177,49 @@
 WINDOW *inf_w;	/* info window for param displ	*/
 WINDOW *right_w;/* highscore list/settings		*/
 
-
+/*
+   PATH_MAX
+   1. tempdir
+   2. dspdevice
+   3. tmp
+   4. cbfilename
+   5. tlfilename
+*/
 int main (int argc, char *argv[]) {
 
   /* if built as osx bundle set DESTDIR to Resources dir of bundle */
 #ifdef OSX_BUNDLE
-  char tempdir[PATH_MAX]=;
+  char *tempdir;
   char* p_slash = strrchr(argv[0], '/');
+  
+  tempdir = malloc( strlen(argv[0]));
+  if(tempdir==NULL){
+printf(Error! memory not allocated.);
+exit(0);
+   }
   strncpy(tempdir, argv[0], p_slash - argv[0]);
+  
   p_slash = strrchr(tempdir, '/');
+  
+  
+  destdir =  malloc( strlen(tempdir));
+  if(destdir==NULL){
+printf(Error! memory not allocated.);
+exit(0);
+  }  
   strncpy(destdir, tempdir, p_slash - tempdir);
+  
+  //realloc(destdir, (strlen(destdir) + strlen(/Resources)) * sizeof(char));
   strcat(destdir, /Resources);
+  free(tempdir)
+  
 #else
+  destdir = malloc( strlen(DESTDIR));
+  if(destdir==NULL){
+printf(Error! memory not allocated.);
+exit(0);
+  }  
+  
   strcpy(destdir, DESTDIR);
 #endif
 
@@ -209,13 +245,16 @@
 	printw(qrq v%s - Copyright (C) 2006-2013 Fabian Kurz, DJ1YFK\n, VERSION);
 	printw(This is free software, and you are welcome to redistribute it\n);
 	printw(under certain conditions (see COPYING).\n);
-
-	refresh();
-
+
+	refresh();
+	
 	/* search for 'toplist', 'qrqrc' and callbase.qcb and put their locations
 	 * into tlfilename, rcfilename, cbfilename */
+	 
+	 
 	find_files();
-
+
+	
 	/* check if the toplist is in the suitable format. as of 0.0.7, each line
 	 * is 31 characters long, with the added time stamp */
 	check_toplist();
@@ -237,6 +276,7 @@
 	
 	/** Reading configuration file **/
 	printw(\nReading configuration file qrqrc \n);
+	
 	read_config();
 
 	attemptvalid = 1;
@@ -245,6 +285,8 @@
 	}
 
 	/** Reading callsign database **/
+	
+	
 	printw(\nReading callsign database... );
 	nrofcalls = read_callbase();
 
@@ -337,11 +379,11 @@
 	
 	/* reset */
 	maxspeed = errornr = score = 0;
-	speed = initialspeed;
+	speed = initialspeed;	
 	
-	/* prompt for own callsign */
+	/* prompt for own callsign */		
 	i = readline(bot_w, 1, 30, mycall, 1);
-
+	
 	/* F5 - Configure sound */
 	if (i == 5) {
 		parameter_dialog();
@@ -544,6 +586,13 @@
 	delwin(mid_w);
 	delwin(right_w);
 	getch();
+	
+	
+	free(cbfilename);	
+free(dspdevice);
+free(tlfilename);
+	free(rcfilename);
+	
 	return 0;
 }
 
@@ -635,6 +684,12 @@
 			break;
 #ifdef OSS
 		case 'e':
+		dspdevice = malloc( 15 * sizeof(char)); // max used in config file
+			if(dspdevice==NULL){
+printf(Error! memory not allocated.);
+exit(0);
+			}  
+  
 			readline(conf_w, 12, 25, dspdevice, 0);
 			if (strlen(dspdevice) == 0) {
 strcpy(dspdevice, /dev/dsp);
@@ -791,22 +846,12 @@
 
 
 
-

Bug#782096: QRQ: FTBFS on hurd-i386: PATH_MAX

2015-04-18 Thread mtang

Hello All,
  i did some modifications on the bug,
see attached, but when i try to run the program
i get the following error:

Failed to write cookie file: Unknown error .. 
when trying to run the program, happens at line 381
i = readline(bot_w, 1, 30, mycall, 1);

Any ideas?


--- qrq.c_original	2015-04-18 07:53:42.0 -0400
+++ qrq.c	2015-04-18 08:25:34.0 -0400
@@ -86,10 +86,10 @@
 
 /* List of available callbase files. Probably no need to do dynamic memory allocation for that list */
 
-static char cblist[100][PATH_MAX];
+static char cblist[100][4096];  // need editing original cblist[100][PATH_MAX]
 
 static char mycall[15]=DJ1YFK;		/* mycall. will be read from qrqrc */
-static char dspdevice[PATH_MAX]=/dev/dsp;	/* will also be read from qrqrc */
+static char *dspdevice;	 /* will also be read from qrqrc */
 static int score = 0;	/* qrq score */
 static int sending_complete;			/* global lock for enter while sending */
 static int callnr = 0;	/* nr of actual call in attempt */
@@ -157,11 +157,11 @@
 pthread_attr_t cwattr;
 #endif
 
-char rcfilename[PATH_MAX]=;			/* filename and path to qrqrc */
-char tlfilename[PATH_MAX]=;			/* filename and path to toplist */
-char cbfilename[PATH_MAX]=;			/* filename and path to callbase */
+char *rcfilename;			/* filename and path to qrqrc */
+char *tlfilename;			/* filename and path to toplist */
+char *cbfilename;			/* filename and path to callbase */
 
-char destdir[PATH_MAX]=;
+char *destdir;
 
 
 /* create windows */
@@ -172,18 +172,49 @@
 WINDOW *inf_w;	/* info window for param displ	*/
 WINDOW *right_w;/* highscore list/settings		*/
 
-
+/*
+   PATH_MAX
+   1. tempdir
+   2. dspdevice
+   3. tmp
+   4. cbfilename
+   5. tlfilename
+*/
 int main (int argc, char *argv[]) {
 
   /* if built as osx bundle set DESTDIR to Resources dir of bundle */
 #ifdef OSX_BUNDLE
-  char tempdir[PATH_MAX]=;
+  char *tempdir;
   char* p_slash = strrchr(argv[0], '/');
+  
+  tempdir = malloc( strlen(argv[0]));
+  if(tempdir==NULL){
+printf(Error! memory not allocated.);
+exit(0);
+   }
   strncpy(tempdir, argv[0], p_slash - argv[0]);
+  
   p_slash = strrchr(tempdir, '/');
+  
+  
+  destdir =  malloc( strlen(tempdir));
+  if(destdir==NULL){
+printf(Error! memory not allocated.);
+exit(0);
+  }  
   strncpy(destdir, tempdir, p_slash - tempdir);
+  
+  //realloc(destdir, (strlen(destdir) + strlen(/Resources)) * sizeof(char));
   strcat(destdir, /Resources);
+  free(tempdir)
+  
 #else
+  destdir = malloc( strlen(DESTDIR));
+  if(destdir==NULL){
+printf(Error! memory not allocated.);
+exit(0);
+  }  
+  
   strcpy(destdir, DESTDIR);
 #endif
 
@@ -209,13 +240,16 @@
 	printw(qrq v%s - Copyright (C) 2006-2013 Fabian Kurz, DJ1YFK\n, VERSION);
 	printw(This is free software, and you are welcome to redistribute it\n);
 	printw(under certain conditions (see COPYING).\n);
-
-	refresh();
-
+
+	refresh();
+	
 	/* search for 'toplist', 'qrqrc' and callbase.qcb and put their locations
 	 * into tlfilename, rcfilename, cbfilename */
+	 
+	 
 	find_files();
-
+
+	
 	/* check if the toplist is in the suitable format. as of 0.0.7, each line
 	 * is 31 characters long, with the added time stamp */
 	check_toplist();
@@ -237,6 +271,7 @@
 	
 	/** Reading configuration file **/
 	printw(\nReading configuration file qrqrc \n);
+	
 	read_config();
 
 	attemptvalid = 1;
@@ -245,6 +280,8 @@
 	}
 
 	/** Reading callsign database **/
+	
+	
 	printw(\nReading callsign database... );
 	nrofcalls = read_callbase();
 
@@ -339,8 +376,10 @@
 	maxspeed = errornr = score = 0;
 	speed = initialspeed;
 	
-	/* prompt for own callsign */
+	/* prompt for own callsign */	
+	
 	i = readline(bot_w, 1, 30, mycall, 1);
+	
 
 	/* F5 - Configure sound */
 	if (i == 5) {
@@ -544,6 +583,13 @@
 	delwin(mid_w);
 	delwin(right_w);
 	getch();
+	
+	
+	free(cbfilename);	
+free(dspdevice);
+free(tlfilename);
+	free(rcfilename);
+	
 	return 0;
 }
 
@@ -635,6 +681,12 @@
 			break;
 #ifdef OSS
 		case 'e':
+		dspdevice = malloc( 15 * sizeof(char)); // max used in config file
+			if(dspdevice==NULL){
+printf(Error! memory not allocated.);
+exit(0);
+			}  
+  
 			readline(conf_w, 12, 25, dspdevice, 0);
 			if (strlen(dspdevice) == 0) {
 strcpy(dspdevice, /dev/dsp);
@@ -1158,7 +1210,7 @@
 	int i=0;
 	int k=0;
 	int line=0;
-
+
 	if ((fh = fopen(rcfilename, r)) == NULL) {
 		endwin();
 		fprintf(stderr, Unable to open config file %s!\n, rcfilename);
@@ -1218,6 +1270,12 @@
 			}
 			tmp[i]='\0';
 			if (strlen(tmp)  1) {
+dspdevice = malloc( 15 * sizeof(char)); // max used in config file 
+if(dspdevice == NULL){
+	printf(Error! memory not allocated.);
+	exit(0);
+}  
+  
 strcpy(dspdevice,tmp);
 printw(  line  %2d: dspdevice: %s\n, line, dspdevice);
 			}
@@ -1306,9 +1364,17 @@
 i++;
 			}
 			tmp[i]='\0';
+			
 			if (strlen(tmp)  1) {
+

Bug#782096: QRQ: FTBFS on hurd-i386: PATH_MAX

2015-04-07 Thread mtang

Package: QRQ
Severity: important
Version: 0.3.1-1
Tags: patch
User: debian-h...@lists.debian.org
Usertags: hurd
X-Debbugs-CC: debian-h...@lists.debian.org

Error recorded in failed_packages.txt

PATH_MAX build error, replaced with _POSIX_PATH_MAX

Noob here, please assist on items i did wrong.
--- qrq.c_backup	2015-04-07 14:55:10.0 -0400
+++ qrq.c	2015-04-07 14:56:02.0 -0400
@@ -31,7 +31,7 @@
 #include libgen.h/* basename */
 #include ctype.h
 #include time.h 
-#include limits.h 			/* PATH_MAX */
+#include limits.h 			/* _POSIX_PATH_MAX */
 #include dirent.h
 #include math.h
 #include fcntl.h
@@ -86,10 +86,10 @@
 
 /* List of available callbase files. Probably no need to do dynamic memory allocation for that list */
 
-static char cblist[100][PATH_MAX];
+static char cblist[100][_POSIX_PATH_MAX];
 
 static char mycall[15]=DJ1YFK;		/* mycall. will be read from qrqrc */
-static char dspdevice[PATH_MAX]=/dev/dsp;	/* will also be read from qrqrc */
+static char dspdevice[_POSIX_PATH_MAX]=/dev/dsp;	/* will also be read from qrqrc */
 static int score = 0;	/* qrq score */
 static int sending_complete;			/* global lock for enter while sending */
 static int callnr = 0;	/* nr of actual call in attempt */
@@ -157,11 +157,11 @@
 pthread_attr_t cwattr;
 #endif
 
-char rcfilename[PATH_MAX]=;			/* filename and path to qrqrc */
-char tlfilename[PATH_MAX]=;			/* filename and path to toplist */
-char cbfilename[PATH_MAX]=;			/* filename and path to callbase */
+char rcfilename[_POSIX_PATH_MAX]=;			/* filename and path to qrqrc */
+char tlfilename[_POSIX_PATH_MAX]=;			/* filename and path to toplist */
+char cbfilename[_POSIX_PATH_MAX]=;			/* filename and path to callbase */
 
-char destdir[PATH_MAX]=;
+char destdir[_POSIX_PATH_MAX]=;
 
 
 /* create windows */
@@ -177,7 +177,7 @@
 
   /* if built as osx bundle set DESTDIR to Resources dir of bundle */
 #ifdef OSX_BUNDLE
-  char tempdir[PATH_MAX]=;
+  char tempdir[_POSIX_PATH_MAX]=;
   char* p_slash = strrchr(argv[0], '/');
   strncpy(tempdir, argv[0], p_slash - argv[0]);
   p_slash = strrchr(tempdir, '/');
@@ -1969,8 +1969,8 @@
 void find_callbases () {
 	DIR *dir;
 	struct dirent *dp;
-	char tmp[PATH_MAX];
-	char path[3][PATH_MAX];
+	char tmp[_POSIX_PATH_MAX];
+	char path[3][_POSIX_PATH_MAX];
 	int i=0,j=0,k=0;
 
 #ifndef WIN32


Bug#782096: QRQ: FTBFS on hurd-i386: PATH_MAX

2015-04-07 Thread Samuel Thibault
Hello,

mt...@openmailbox.org, le Tue 07 Apr 2015 16:23:42 -0400, a écrit :
 PATH_MAX build error, replaced with _POSIX_PATH_MAX
 
 Noob here, please assist on items i did wrong.

Please read

https://www.gnu.org/software/hurd/hurd/porting/guidelines.html

which explains that PATH_MAX and _POSIX_PATH_MAX are really not the same
thing.

Samuel


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org