Re: Convert mp3 to audio CD

2012-03-21 Thread Polytropon
On Tue, 20 Mar 2012 23:10:16 -0400, Steve Bertrand wrote:
 I know this is a backwards request, as I haven't had to go from mp3 to 
 audio CD format in at least 10 years, but I do now.
 
 What is available to do so?

This script, ugly as hell, but works. :-)

You need to install madplay or mpg123, as well as sox.
If you also want to convert Ogg/Vorbis files, you need
ogg123 (vorbis-tools). And of course you need a cd
burning program such as cdrdao or cdrecord. See the
examples for calling them at the end of the script.







#!/bin/sh

echo === MP3 + OGG/Vorbis - Audio CD Converter 
===
echo -n MP3 decoders found:
DECODER=0
which mpg123  /dev/null 21
if [ $? -eq 0 ]; then
DECODER=2
echo -n  mpg123
fi
which madplay  /dev/null 21
if [ $? -eq 0 ]; then
DECODER=1
echo -n  madplay
fi
if [ $DECODER -eq 0 ]; then
echo none, aborting.
exit 1
fi
echo -n , using 
if [ $DECODER -eq 1 ]; then
echo madplay.
else
echo -n mpg123
which madplay  /dev/null 21
if [ $? -eq 0 ]; then
echo  and sox.
else
echo , but sox is not available, exiting.
exit 1
fi
fi
echo -n OGG/Vorbis decoders found:
which ogg123  /dev/null 21
if [ $? -eq 0 ]; then
echo  ogg123.
else
echo none, aborting.
exit 1
fi

TOCFILE=audiocd.toc
echo CD_DA  $TOCFILE

FILELIST=`ls *.[mo][pg][3g]`
if [ $FILELIST =  ]; then
echo No files (*.mp3 and/or *.ogg) found, aborting.
exit 1
fi

for FILE in *.[mo][pg][3g]; do
echo -n $FILE - 
echo $FILE | grep/dev/null 21
if [ $? -eq 0 ]; then
echo filename contains spaces, cannot proceed.
exit 1
fi
TYPE=
echo $FILE | grep .mp3  /dev/null 21
if [ $? -eq 0 ]; then
TYPE=mp3
fi
echo $FILE | grep .ogg  /dev/null 21
if [ $? -eq 0 ]; then
TYPE=ogg
fi
if [ $TYPE = ogg ]; then
ogg123 -q -d raw -f $FILE.raw $FILE
sox -r 44100 -c 2 -w -s $FILE.raw $FILE.cdr
rm $FILE.raw
elif [ $TYPE = mp3 ]; then
case $DECODER in
1)
madplay -q -o cdda:$FILE.cdr $FILE
;;
2)
mpg123 -sq $FILE  $FILE.raw
sox -r 44100 -c 2 -w -s $FILE.raw $FILE.cdr
rm $FILE.raw
;;
esac
elif [ $TYPE =  ]; then
echo file type unknown, aborting.
exit 1
fi
echo $FILE.cdr
echo TRACK AUDIO COPY AUDIOFILE \$FILE.cdr\ 0  $TOCFILE
done
echo Your recording command could be:
echo  # cdrecord -eject -v -dao -audio *.cdr
echo  # cdrdao write --eject audiocd.toc
echo After finished, don't forget to delete converter garbage:
echo  # rm *.cdr audiocd.toc
echo 
==
exit 0




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Convert mp3 to audio CD

2012-03-21 Thread Da Rock

On 03/21/12 13:10, Steve Bertrand wrote:
I know this is a backwards request, as I haven't had to go from mp3 to 
audio CD format in at least 10 years, but I do now.


What is available to do so?
There is something in ports to do this - don't ask me which, but I 
noticed it in there recently :) It was in the list with k3b and other cd 
burning utils.


Sorry thats all I can remember atm.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: dbus, epiphany, rekonq

2012-03-21 Thread Anton Shterenlikht
On Wed, Mar 21, 2012 at 04:12:50AM +0100, Bernt Hansson wrote:
 2012-03-19 13:21, Anton Shterenlikht skrev:
 I can't lauch www/epiphany or www/rekonq
 on ia64 -current, due to some dbus issue:
 
 TZAV  ps ax|grep dbus
   1435  -  Is   0:00.02 /usr/local/bin/dbus-daemon --fork --print-pid 
   5 --print-address 7 --sess
   1434  2- I0:00.01 dbus-launch 
   --autolaunch=fb0372ea595109904f5a068e0180 --binary-synta
 41284  5  RL+  0:00.00 grep dbus
 
 TZAV  epiphany
 
 ** (epiphany:41285): WARNING **: Unable to connect to session bus: Failed 
 to connect to socket /tmp/dbus-dyUjnhLBwE: No such file or directory
 
 TZAV  rekonq
 unnamed app(41291): KUniqueApplication: Cannot find the D-Bus session 
 server:  Failed to connect to socket /tmp/dbus-dyUjnhLBwE: No such file 
 or directory
 
 unnamed app(41290): KUniqueApplication: Pipe closed unexpectedly.
 
 TZAV  ps ax | grep dbus
   1435  -  Is   0:00.02 /usr/local/bin/dbus-daemon --fork --print-pid 
   5 --print-address 7 --sess
   1434  2- I0:00.01 dbus-launch 
   --autolaunch=fb0372ea595109904f5a068e0180 --binary-synta
 41294  5  RL+  0:00.00 grep dbus
 
 What am I doing wrong?
 
 I understand dbus is a required part of
 a modern browser, it is no longer an option, right?
 
 Many thanks
 
 You do have this in /etc/rc.conf
 
 dbus_enable=YES

I didn't think it was necessary, as firefox3
launches dbus-daemon on startup. But I'll give
it a go.

Thanks

-- 
Anton Shterenlikht
Room 2.6, Queen's Building
Mech Eng Dept
Bristol University
University Walk, Bristol BS8 1TR, UK
Tel: +44 (0)117 331 5944
Fax: +44 (0)117 929 4423
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: dbus, epiphany, rekonq

2012-03-21 Thread Polytropon
On Wed, 21 Mar 2012 09:29:09 +, Anton Shterenlikht wrote:
 On Wed, Mar 21, 2012 at 04:12:50AM +0100, Bernt Hansson wrote:
  You do have this in /etc/rc.conf
  
  dbus_enable=YES
 
 I didn't think it was necessary, as firefox3
 launches dbus-daemon on startup. But I'll give
 it a go.

I think those are mandatory when running X + { KDE | Gnome }.
Maybe it's even required for running KDE or Gnome applications
without the whole desktop environment? Maybe the dependencies
are that deep that they affect the libraries used...

Always check for

hald_enable=YES
dbus_enable=YES

in your /etc/rc.conf.

See:
http://www.freebsd.org/gnome/docs/halfaq.html


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Convert mp3 to audio CD

2012-03-21 Thread Rod Person
On Tue, 20 Mar 2012 23:10:16 -0400
Steve Bertrand steve.bertr...@gmail.com wrote:

 I know this is a backwards request, as I haven't had to go from mp3
 to audio CD format in at least 10 years, but I do now.
 
 What is available to do so?
 

Basically the same as other, but just using lame to convert a directory
full of mp3s


#!/bin/sh

for a in *
do
  OUTF=`echo $a | sed s/\.mp3/.wav/g`
  lame --decode -q 0 $a $OUTF
done



-- 

Rod Person  http://www.rodperson.com  rodper...@rodperson.com

'Silence is a fence around wisdom'
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Convert mp3 to audio CD

2012-03-21 Thread Polytropon
On Wed, 21 Mar 2012 07:07:40 -0400, Rod Person wrote:
 On Tue, 20 Mar 2012 23:10:16 -0400
 Steve Bertrand steve.bertr...@gmail.com wrote:
 
  I know this is a backwards request, as I haven't had to go from mp3
  to audio CD format in at least 10 years, but I do now.
  
  What is available to do so?
  
 
 Basically the same as other, but just using lame to convert a directory
 full of mp3s
 
 
 #!/bin/sh
 
 for a in *
 do
   OUTF=`echo $a | sed s/\.mp3/.wav/g`
   lame --decode -q 0 $a $OUTF
 done

Just note that those *.wav files will have to be in the
correct format (44.1 kHz two-channel 16 bit) and maybe
require byte order reversal as well as stripping the
WAV headers to record them as a music CD. It seems that
some recording programs already contain this step. Refer
to audio CD specifications for why pure WAV files don't
make an audio CD.




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Convert mp3 to audio CD

2012-03-21 Thread Rod Person
On Wed, 21 Mar 2012 12:16:24 +0100
Polytropon free...@edvax.de wrote:

 On Wed, 21 Mar 2012 07:07:40 -0400, Rod Person wrote:
  On Tue, 20 Mar 2012 23:10:16 -0400
  Steve Bertrand steve.bertr...@gmail.com wrote:
  
   I know this is a backwards request, as I haven't had to go from
   mp3 to audio CD format in at least 10 years, but I do now.
   
   What is available to do so?
   
  
  Basically the same as other, but just using lame to convert a
  directory full of mp3s
  
  
  #!/bin/sh
  
  for a in *
  do
OUTF=`echo $a | sed s/\.mp3/.wav/g`
lame --decode -q 0 $a $OUTF
  done
 
 Just note that those *.wav files will have to be in the
 correct format (44.1 kHz two-channel 16 bit) and maybe
 require byte order reversal as well as stripping the
 WAV headers to record them as a music CD. It seems that
 some recording programs already contain this step. Refer
 to audio CD specifications for why pure WAV files don't
 make an audio CD.
 

I've used this for years and never had an issues, but to accomplish
removing the header you would use the -t option along with --decode for
lame and -x does a bit swap, but not sure if that is the same byte order
reversal.





-- 

Rod Person  http://www.rodperson.com  rodper...@rodperson.com

'Silence is a fence around wisdom'
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Convert mp3 to audio CD

2012-03-21 Thread Polytropon
On Wed, 21 Mar 2012 07:25:11 -0400, Rod Person wrote:
 On Wed, 21 Mar 2012 12:16:24 +0100
 Polytropon free...@edvax.de wrote:
 
  On Wed, 21 Mar 2012 07:07:40 -0400, Rod Person wrote:
   On Tue, 20 Mar 2012 23:10:16 -0400
   Steve Bertrand steve.bertr...@gmail.com wrote:
   
I know this is a backwards request, as I haven't had to go from
mp3 to audio CD format in at least 10 years, but I do now.

What is available to do so?

   
   Basically the same as other, but just using lame to convert a
   directory full of mp3s
   
   
   #!/bin/sh
   
   for a in *
   do
 OUTF=`echo $a | sed s/\.mp3/.wav/g`
 lame --decode -q 0 $a $OUTF
   done
  
  Just note that those *.wav files will have to be in the
  correct format (44.1 kHz two-channel 16 bit) and maybe
  require byte order reversal as well as stripping the
  WAV headers to record them as a music CD. It seems that
  some recording programs already contain this step. Refer
  to audio CD specifications for why pure WAV files don't
  make an audio CD.
  
 
 I've used this for years and never had an issues, but to accomplish
 removing the header you would use the -t option along with --decode for
 lame and -x does a bit swap, but not sure if that is the same byte order
 reversal.

Yes, I think that's the correct approach. My old script,
written when I was new to FreeBSD (at v4.0), uses the
unelegant sox -r 44100 -c 2 -w -s $FILE.raw $FILE.cdr
to convert to the proper CD audio format which could
also be used by burncd (deprecated?), but also by cdrdao
and cdrecord with no additional conversion parameters.

Thanks for the hint about lame --decode!



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: dbus, epiphany, rekonq

2012-03-21 Thread Da Rock

On 03/21/12 19:29, Anton Shterenlikht wrote:

On Wed, Mar 21, 2012 at 04:12:50AM +0100, Bernt Hansson wrote:

2012-03-19 13:21, Anton Shterenlikht skrev:

I can't lauch www/epiphany or www/rekonq
on ia64 -current, due to some dbus issue:

TZAV   ps ax|grep dbus
  1435  -  Is   0:00.02 /usr/local/bin/dbus-daemon --fork --print-pid
  5 --print-address 7 --sess
  1434  2- I0:00.01 dbus-launch
  --autolaunch=fb0372ea595109904f5a068e0180 --binary-synta
41284  5  RL+  0:00.00 grep dbus

TZAV   epiphany

** (epiphany:41285): WARNING **: Unable to connect to session bus: Failed
to connect to socket /tmp/dbus-dyUjnhLBwE: No such file or directory

TZAV   rekonq
unnamed app(41291): KUniqueApplication: Cannot find the D-Bus session
server:  Failed to connect to socket /tmp/dbus-dyUjnhLBwE: No such file
or directory

unnamed app(41290): KUniqueApplication: Pipe closed unexpectedly.

TZAV   ps ax | grep dbus
  1435  -  Is   0:00.02 /usr/local/bin/dbus-daemon --fork --print-pid
  5 --print-address 7 --sess
  1434  2- I0:00.01 dbus-launch
  --autolaunch=fb0372ea595109904f5a068e0180 --binary-synta
41294  5  RL+  0:00.00 grep dbus

What am I doing wrong?

I understand dbus is a required part of
a modern browser, it is no longer an option, right?

Many thanks


You do have this in /etc/rc.conf

dbus_enable=YES

I didn't think it was necessary, as firefox3
launches dbus-daemon on startup. But I'll give
it a go.

Thanks
This got me: you need dbus_enable in the rc.conf  (for global, this I 
have observed for a long time), but you apparently need it _per session_ 
as well.


dbus and hal work together at the system level to facilitate device 
addition and removal notification; dbus at the session level provides 
notification between the apps and the system notifications (redundant 
given FreeBSDs already in place notification systems).


This how the file managers add new devices and filesystems to the 
place listings. To do this you need to have a dbus session running per 
user, and a few more convoluted processes to ensure each app uses it.


So you use the addition to the xsession script posted, console-kit 
(possibly), and dbus-launch for every app. Fun... groan


As to whether all this applies in your particular case... but 
essentially this how it is used. HIH

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Freebsd9.0 and the fgets directive in gcc

2012-03-21 Thread Martin McCormick
I've got some code which I wrote about 6 or 8 years ago that
apparently doesn't get along right now with FreeBSD9.0. In the
problem code, there is a loop that uses fgets to read a line
from a file. It runs properly until the 2708TH iteration and
then it dumps core with a segmentation fault.

char string0[256];
more lines of code . . .

while ( fgets(string0,sizeof(string0),fp_config)) {
code to be run for each line
}

It runs fine until the 2,709TH iteration. Instead of
reading the next line, it jumps to the line that closes
fp_config even though it is far from read and exits with the
segmentation fault.

The man page on fgets says that if errors occur while
running fgets, one must use perr to see whether the error
terminated activity or it was the end of the file. In this case,
it is definitely the error.

Some observations:

The crash occurs on the 2,709TH input no matter how long I
declared string0 to be. string0 is over-written each new
iteration so nothing should be accumulating that uses up
resources.

Maybe I am declaring string0 in the wrong data type.
Originally, it had been 1024 characters long but 2709 seems to
be the C equivalent to the apocalypse and I thought it was
supposed to be next December:-)

This same code, by the way, also fails at about the same
number of iterations if one uses fgetc and  builds the line one
char at a time.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: dbus, epiphany, rekonq

2012-03-21 Thread Anton Shterenlikht
On Wed, Mar 21, 2012 at 10:51:23AM +0100, Polytropon wrote:
 On Wed, 21 Mar 2012 09:29:09 +, Anton Shterenlikht wrote:
  On Wed, Mar 21, 2012 at 04:12:50AM +0100, Bernt Hansson wrote:
   You do have this in /etc/rc.conf
   
   dbus_enable=YES
  
  I didn't think it was necessary, as firefox3
  launches dbus-daemon on startup. But I'll give
  it a go.
 
 I think those are mandatory when running X + { KDE | Gnome }.
 Maybe it's even required for running KDE or Gnome applications
 without the whole desktop environment? Maybe the dependencies
 are that deep that they affect the libraries used...
 
 Always check for
 
   hald_enable=YES
   dbus_enable=YES
 
 in your /etc/rc.conf.
 
 See:
 http://www.freebsd.org/gnome/docs/halfaq.html

That's funny. Now I'm back to

TZAV ps ax|grep dbus
15636  -  Is  0:00.06 /usr/local/bin/dbus-daemon --system
15726  -  Is  0:00.01 /usr/local/bin/dbus-daemon --fork --print-pid 5 
--print-address 7 --sessi
11463  0- I   0:00.01 dbus-launch --autolaunch 
fb0372ea595109904f5a068e0180 --binary-syntax
10857  6  R+  0:00.01 grep dbus
TZAV ps ax | grep hald
15647  -  Is  0:04.57 /usr/local/sbin/hald
15654  -  I   0:00.08 hald-runner
10859  6  R+  0:00.01 grep hald
TZAV epiphany

** (epiphany:10860): WARNING **: Unable to connect to session bus: Failed to 
connect to socket /tmp/dbus-7LOjFYELtv: No such file or directory
TZAV rekonq 
unnamed app(10863): KUniqueApplication: Cannot find the D-Bus session server:  
Failed to connect to socket /tmp/dbus-7LOjFYELtv: No such file or directory 

unnamed app(10862): KUniqueApplication: Pipe closed unexpectedly. 

TZAV 

Thanks anyway


-- 
Anton Shterenlikht
Room 2.6, Queen's Building
Mech Eng Dept
Bristol University
University Walk, Bristol BS8 1TR, UK
Tel: +44 (0)117 331 5944
Fax: +44 (0)117 929 4423
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: dbus, epiphany, rekonq

2012-03-21 Thread Bernt Hansson

2012-03-21 10:29, Anton Shterenlikht skrev:

On Wed, Mar 21, 2012 at 04:12:50AM +0100, Bernt Hansson wrote:

2012-03-19 13:21, Anton Shterenlikht skrev:

I can't lauch www/epiphany or www/rekonq
on ia64 -current, due to some dbus issue:

TZAV   ps ax|grep dbus
  1435  -  Is   0:00.02 /usr/local/bin/dbus-daemon --fork --print-pid
  5 --print-address 7 --sess
  1434  2- I0:00.01 dbus-launch
  --autolaunch=fb0372ea595109904f5a068e0180 --binary-synta
41284  5  RL+  0:00.00 grep dbus

TZAV   epiphany

** (epiphany:41285): WARNING **: Unable to connect to session bus: Failed
to connect to socket /tmp/dbus-dyUjnhLBwE: No such file or directory

TZAV   rekonq
unnamed app(41291): KUniqueApplication: Cannot find the D-Bus session
server:  Failed to connect to socket /tmp/dbus-dyUjnhLBwE: No such file
or directory

unnamed app(41290): KUniqueApplication: Pipe closed unexpectedly.

TZAV   ps ax | grep dbus
  1435  -  Is   0:00.02 /usr/local/bin/dbus-daemon --fork --print-pid
  5 --print-address 7 --sess
  1434  2- I0:00.01 dbus-launch
  --autolaunch=fb0372ea595109904f5a068e0180 --binary-synta
41294  5  RL+  0:00.00 grep dbus

What am I doing wrong?

I understand dbus is a required part of
a modern browser, it is no longer an option, right?

Many thanks


You do have this in /etc/rc.conf

dbus_enable=YES


I didn't think it was necessary,


It is.


as firefox3 launches dbus-daemon on startup.


Only for that firefox3 process, no one else get in.


But I'll give it a go.


Do that, and my guess is you are going to be a lot happier.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Freebsd9.0 and the fgets directive in gcc

2012-03-21 Thread Martin McCormick
Never mind. I may be back with another question, but I figured
out that it is not the input loop. I simply removed all the code
in the loop except for a variable that counts the number of
iterations and just ran thatand it read the entire file so the
problem is introduced when assigning values to variables based
on the contents of the lines. It is something that worked okay
up to FreeBSD8.X but now causes a segmentation fault.
Martin McCormick writes:
 I've got some code which I wrote about 6 or 8 years ago that
 apparently doesn't get along right now with FreeBSD9.0. In the
 problem code, there is a loop that uses fgets to read a line
 from a file. It runs properly until the 2708TH iteration and
 then it dumps core with a segmentation fault.
 
 char string0[256];
 more lines of code . . .
 
 while ( fgets(string0,sizeof(string0),fp_config)) {
 code to be run for each line
 }
 
 It runs fine until the 2,709TH iteration. Instead of
 reading the next line, it jumps to the line that closes
 fp_config even though it is far from read and exits with the
 segmentation fault.
 
 The man page on fgets says that if errors occur while
 running fgets, one must use perr to see whether the error
 terminated activity or it was the end of the file. In this case,
 it is definitely the error.
 
 Some observations:
 
 The crash occurs on the 2,709TH input no matter how long I
 declared string0 to be. string0 is over-written each new
 iteration so nothing should be accumulating that uses up
 resources.
 
 Maybe I am declaring string0 in the wrong data type.
 Originally, it had been 1024 characters long but 2709 seems to
 be the C equivalent to the apocalypse and I thought it was
 supposed to be next December:-)
 
 This same code, by the way, also fails at about the same
 number of iterations if one uses fgetc and  builds the line one
 char at a time.
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to 
 freebsd-questions-unsubscr...@freebsd.org
 
 
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Freebsd9.0 and the fgets directive in gcc

2012-03-21 Thread Robert Huff

Martin McCormick writes:

  I've got some code which I wrote about 6 or 8 years ago that
  apparently doesn't get along right now with FreeBSD9.0. In the
  problem code, there is a loop that uses fgets to read a line
  from a file. It runs properly until the 2708TH iteration and
  then it dumps core with a segmentation fault.

deletia
Have you built this program with debugging turned on?
What does the core dump say?

Respectfully,


Robert Huff
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Freebsd9.0 and the fgets directive in gcc

2012-03-21 Thread Brad Mettee

On 3/21/2012 10:50 AM, Martin McCormick wrote:

I've got some code which I wrote about 6 or 8 years ago that
apparently doesn't get along right now with FreeBSD9.0. In the
problem code, there is a loop that uses fgets to read a line
from a file. It runs properly until the 2708TH iteration and
then it dumps core with a segmentation fault.

char string0[256];
more lines of code . . .

while ( fgets(string0,sizeof(string0),fp_config)) {
code to be run for each line
}

It runs fine until the 2,709TH iteration. Instead of
reading the next line, it jumps to the line that closes
fp_config even though it is far from read and exits with the
segmentation fault.

The man page on fgets says that if errors occur while
running fgets, one must use perr to see whether the error
terminated activity or it was the end of the file. In this case,
it is definitely the error.

Some observations:

The crash occurs on the 2,709TH input no matter how long I
declared string0 to be. string0 is over-written each new
iteration so nothing should be accumulating that uses up
resources.

Maybe I am declaring string0 in the wrong data type.
Originally, it had been 1024 characters long but 2709 seems to
be the C equivalent to the apocalypse and I thought it was
supposed to be next December:-)

This same code, by the way, also fails at about the same
number of iterations if one uses fgetc and  builds the line one
char at a time.



Have you tried allocating a large block of maybe 15-20k (using alloc, or 
calloc) instead of declaring it on the stack? You can print the length 
of the line (and iteration count) for each line processed and see what 
max line length is.


What you describe sounds more like a problem with the content of the 
file overflowing the space allocated and causing a stack fault than 
something wrong with fgets (especially if fgetc and concatenating the 
string causes the same problem).


Also, what happens if you remove your processing code and replace it 
with a print of the line length  the iteration count? Compilers have 
been know to generate buggy loop code sometimes, so that's also a 
possibility.



--
Brad Mettee
PC HotShots, Inc.
Westminster, MD
(410) 848-0588
- Let us bring out the **Power** of your PCs. -
- Custom Business Software Solutions since 1991 -
Visit us http://www.pchotshots.com for information about our company.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Freebsd9.0 and the fgets directive in gcc

2012-03-21 Thread Erich Dollansky
Hi,

On Wednesday 21 March 2012 21:50:25 Martin McCormick wrote:
 I've got some code which I wrote about 6 or 8 years ago that
 apparently doesn't get along right now with FreeBSD9.0. In the
 problem code, there is a loop that uses fgets to read a line
 from a file. It runs properly until the 2708TH iteration and
 then it dumps core with a segmentation fault.
 
 char string0[256];
 more lines of code . . .
 
 while ( fgets(string0,sizeof(string0),fp_config)) {

how long is one line? Could it be that the failing line has 256 or more 
characters?

I would use

while ( fgets(string0,sizeof(string0) -1,fp_config)) {

to make sure that the last character does not cause a buffer overrun, no matter 
what fgets is supposed to do.

Erich
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: dbus, epiphany, rekonq

2012-03-21 Thread Bernt Hansson

2012-03-21 16:18, Anton Shterenlikht skrev:

On Wed, Mar 21, 2012 at 10:51:23AM +0100, Polytropon wrote:

On Wed, 21 Mar 2012 09:29:09 +, Anton Shterenlikht wrote:

On Wed, Mar 21, 2012 at 04:12:50AM +0100, Bernt Hansson wrote:

You do have this in /etc/rc.conf

dbus_enable=YES


I didn't think it was necessary, as firefox3
launches dbus-daemon on startup. But I'll give
it a go.


I think those are mandatory when running X + { KDE | Gnome }.
Maybe it's even required for running KDE or Gnome applications
without the whole desktop environment? Maybe the dependencies
are that deep that they affect the libraries used...

Always check for

hald_enable=YES
dbus_enable=YES

in your /etc/rc.conf.

See:
http://www.freebsd.org/gnome/docs/halfaq.html


That's funny. Now I'm back to

TZAV  ps ax|grep dbus
15636  -  Is  0:00.06 /usr/local/bin/dbus-daemon --system
15726  -  Is  0:00.01 /usr/local/bin/dbus-daemon --fork --print-pid 5 
--print-address 7 --sessi
11463  0- I   0:00.01 dbus-launch --autolaunch 
fb0372ea595109904f5a068e0180 --binary-syntax
10857  6  R+  0:00.01 grep dbus
TZAV  ps ax | grep hald
15647  -  Is  0:04.57 /usr/local/sbin/hald
15654  -  I   0:00.08 hald-runner
10859  6  R+  0:00.01 grep hald
TZAV  epiphany

** (epiphany:10860): WARNING **: Unable to connect to session bus: Failed to 
connect to socket /tmp/dbus-7LOjFYELtv: No such file or directory
TZAV  rekonq
unnamed app(10863): KUniqueApplication: Cannot find the D-Bus session server:  
Failed to connect to socket /tmp/dbus-7LOjFYELtv: No such file or directory

unnamed app(10862): KUniqueApplication: Pipe closed unexpectedly.

TZAV


To me it seems that dbus can't write to /tmp and/or create files under /tmp.

This is my home desktop

 915  ??  Is 0:04,06 /usr/local/bin/dbus-daemon --system
 1317  ??  Is 0:00,24 /usr/local/bin/dbus-daemon --fork --print-pid 
5 --print-address 7 --session
 3763  ??  Is 0:00,35 /usr/local/bin/dbus-daemon --fork --print-pid 
5 --print-address 7 --session
 8557  ??  Is 0:00,21 /usr/local/bin/dbus-daemon --fork --print-pid 
5 --print-address 7 --session





1186  ??  Is 3:47,36 /usr/local/sbin/hald
 1193  ??  I  0:00,12 hald-runner
 1197  ??  S  0:37,69 hald-addon-storage: no polling on /dev/fd0 
because it is explicitly disabled (hald-addon-storag
 1241  ??  IW 0:00,00 hald-addon-mouse-sysmouse: /dev/ums0 
(hald-addon-mouse-sy)



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Find run-time dependancies recursively for FreeBSD port

2012-03-21 Thread Rick Miller
Hi all,

I can get run-time depends by executing make run-depends-list or all
dependancies by running make all-depends-list.  Is there a way to get
all run-time depends recursively (I don't need the build depends or
their depends)?

-- 
Take care
Rick Miller
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Find run-time dependancies recursively for FreeBSD port

2012-03-21 Thread Greg Larkin
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 3/21/12 12:51 PM, Rick Miller wrote:
 Hi all,
 
 I can get run-time depends by executing make run-depends-list or
 all dependancies by running make all-depends-list.  Is there a way
 to get all run-time depends recursively (I don't need the build
 depends or their depends)?
 

Hi Rick,

The closest I see in bsd.port.mk are the following targets, but I
think they include LIB_DEPENDS as well:

package-depends-list
actual-package-depends

Hope that helps,
Greg
- -- 
Greg Larkin

http://www.FreeBSD.org/   - The Power To Serve
http://www.sourcehosting.net/ - Ready. Set. Code.
http://twitter.com/cpucycle/  - Follow you, follow me
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk9qDLUACgkQ0sRouByUApDiqgCguy0v3CoiLLGpKWmcTkwmYelU
NJ4AoISFXcPtr00gxcKH+3SPHstnFwRs
=IZU/
-END PGP SIGNATURE-
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Find run-time dependancies recursively for FreeBSD port

2012-03-21 Thread Rick Miller
Thanks Greg,

I just found the following link in the list archives which gave me an
idea that I am currently working on...

http://osdir.com/ml/freebsd-questions/2009-04/msg00929.html

On Wed, Mar 21, 2012 at 1:15 PM, Greg Larkin glar...@freebsd.org wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 On 3/21/12 12:51 PM, Rick Miller wrote:
 Hi all,

 I can get run-time depends by executing make run-depends-list or
 all dependancies by running make all-depends-list.  Is there a way
 to get all run-time depends recursively (I don't need the build
 depends or their depends)?


 Hi Rick,

 The closest I see in bsd.port.mk are the following targets, but I
 think they include LIB_DEPENDS as well:

 package-depends-list
 actual-package-depends

 Hope that helps,
 Greg
 - --
 Greg Larkin

 http://www.FreeBSD.org/           - The Power To Serve
 http://www.sourcehosting.net/     - Ready. Set. Code.
 http://twitter.com/cpucycle/      - Follow you, follow me
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.11 (Darwin)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

 iEYEARECAAYFAk9qDLUACgkQ0sRouByUApDiqgCguy0v3CoiLLGpKWmcTkwmYelU
 NJ4AoISFXcPtr00gxcKH+3SPHstnFwRs
 =IZU/
 -END PGP SIGNATURE-



-- 
Take care
Rick Miller
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Find run-time dependancies recursively for FreeBSD port

2012-03-21 Thread Matthew Seaman
On 21/03/2012 16:51, Rick Miller wrote:
 I can get run-time depends by executing make run-depends-list or all
 dependancies by running make all-depends-list.  Is there a way to get
 all run-time depends recursively (I don't need the build depends or
 their depends)?

If your INDEX is up to date:

   % cd /usr/ports
   % make search name=packagename-1.2.3 display=rdeps

or

   % make search path=devel/foo display=rdeps

Cheers,

Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.   7 Priory Courtyard
  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate
JID: matt...@infracaninophile.co.uk   Kent, CT11 9PW



signature.asc
Description: OpenPGP digital signature


Re: Find run-time dependancies recursively for FreeBSD port

2012-03-21 Thread Rick Miller
Thanks Matthew...

On Wed, Mar 21, 2012 at 2:35 PM, Matthew Seaman
m.sea...@infracaninophile.co.uk wrote:
 On 21/03/2012 16:51, Rick Miller wrote:
 I can get run-time depends by executing make run-depends-list or all
 dependancies by running make all-depends-list.  Is there a way to get
 all run-time depends recursively (I don't need the build depends or
 their depends)?

 If your INDEX is up to date:

   % cd /usr/ports
   % make search name=packagename-1.2.3 display=rdeps

 or

   % make search path=devel/foo display=rdeps

The problem here is that this does not return recursive results,
meaning run-time dependancies of run-time dependancies.  Having said
that, These commands provide me some alternatives in a script I am
writing to ascertain this data for me.

-- 
Take care
Rick Miller
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


port2

2012-03-21 Thread r p

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

Re: Find run-time dependancies recursively for FreeBSD port

2012-03-21 Thread Matthew Seaman
On 21/03/2012 19:10, Rick Miller wrote:
 Thanks Matthew...
 
 On Wed, Mar 21, 2012 at 2:35 PM, Matthew Seaman
 m.sea...@infracaninophile.co.uk wrote:
 On 21/03/2012 16:51, Rick Miller wrote:
 I can get run-time depends by executing make run-depends-list or all
 dependancies by running make all-depends-list.  Is there a way to get
 all run-time depends recursively (I don't need the build depends or
 their depends)?

 If your INDEX is up to date:

   % cd /usr/ports
   % make search name=packagename-1.2.3 display=rdeps

 or

   % make search path=devel/foo display=rdeps
 
 The problem here is that this does not return recursive results,
 meaning run-time dependancies of run-time dependancies.  Having said
 that, These commands provide me some alternatives in a script I am
 writing to ascertain this data for me.
 

Yes it does.

Cheers,

Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.   7 Priory Courtyard
  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate
JID: matt...@infracaninophile.co.uk   Kent, CT11 9PW



signature.asc
Description: OpenPGP digital signature


Re: Find run-time dependancies recursively for FreeBSD port

2012-03-21 Thread Rick Miller
 Yes it does.

pebcak, thanks.


-- 
Take care
Rick Miller
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Problem compiling emulators/virtualbox-ose-kmod 4.1.8_2

2012-03-21 Thread Lowell Gilbert
Mike Clarke jmc-freeb...@milibyte.co.uk writes:

 On Friday 16 March 2012, Lowell Gilbert wrote:

 My best advice is: clean out the directory for that port, update
 again, and see if the problem is the same.

 I've now deleted everything in /usr/ports/emulators/virtualbox-ose-kmod and 
 downloaded a fresh copy of the 
 port (4.1.10) from the FreeBSD website but still get the same problem when 
 compiling.

 /data1/tmp/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.1.10/out/freebsd.x86/
   
   
 release/bin/src/vboxdrv/r0drv/freebsd/memobj-r0drv-freebsd.c:405: error: 
 invalid type argument of '-'
 *** Error code 1

That line is supposed to be an assignment in between a VM_OBJECT_LOCK
and the corresponding VM_OBJECT_UNLOCK. Can you confirm that the patches
cause this to be the case? It is a little tricky for me to edit files in
an i386 environment, but the next step is to track down the definition
of PRTR0MEMOBJFREEBSD, assuming that is the dereference giving the error
on your system, and determining whether it ought to have the structure
entry being dereferenced.

 I've also updated the source files for the base system and built a new kernel 
 in case it's a header problem 
 since I noticed that /usr/src/include/unistd.h and 
 /usr/src/lib/libc/include/libc_private.h were both updated 
 in security advisory SA-11:07 (for which I only did a binary update at the 
 time) but this didn't cure the 
 problem.

 I've had no problem building earlier versions but it went pear shaped with 
 4.1.8_2

 As an experiment I've used portdowngrade to try compiling a few older 
 versions 

 number date portversion  comment
 1  2012/03/15 09:32:29  VirtualBox-${DISTVERSION}  - Update to 4.1.10
 2  2012/03/09 21:46:18  VirtualBox-${DISTVERSION}_2  - Reenabled fixed 
 memobj r0 patch
 3  2012/02/22 22:09:41  VirtualBox-${DISTVERSION}_1  - Revert memobj r0 
 patch until the problems on i386 
 are solved
 4  2012/02/21 14:31:54  VirtualBox-${DISTVERSION}  - Update to 4.1.8

 Of these, the only one to compile OK was 4.1.8_1 so it looks like the fixed 
 memobj r0 patch still has problems 
 on my system.

 FreeBSD curlew.lan 8.1-RELEASE-p8 FreeBSD 8.1-RELEASE-p8 #0: Tue Mar 20 
 19:00:39 GMT 2012 
 r...@curlew.lan:/usr/obj/usr/src/sys/GENERIC  i386

I can't reproduce the problem. My i386 system is a little weird, so that
may not say much.

Also, my system code trees are updated more recently than yours, which
may well matter for a kernel module, such as this port builds. You might
want to try updating your system or trying the -legacy version of the port.

Be well.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Problem compiling emulators/virtualbox-ose-kmod 4.1.8_2

2012-03-21 Thread Mike Clarke
On Wednesday 21 March 2012, Lowell Gilbert wrote:

  /data1/tmp/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-
 4.1.10/out/freebsd.x86/                                            
                                             
  release/bin/src/vboxdrv/r0drv/freebsd/memobj-r0drv-freebsd.c:405:
  error: invalid type argument of '-'
  *** Error code 1

 That line is supposed to be an assignment in between a VM_OBJECT_LOCK
 and the corresponding VM_OBJECT_UNLOCK. Can you confirm that the
 patches cause this to be the case?

Yes, that's where it is.

401 if (fContiguous)
402 {
403 Assert(enmType == RTR0MEMOBJTYPE_PHYS);
404 VM_OBJECT_LOCK(pMemFreeBSD-pObject);
405 pMemFreeBSD-Core.u.Phys.PhysBase = 
VM_PAGE_TO_PHYS(vm_page_find_least(pMemFreeBSD-pObject, 0));
406 VM_OBJECT_UNLOCK(pMemFreeBSD-pObject);
407 pMemFreeBSD-Core.u.Phys.fAllocated = true;
408 }

 It is a little tricky for me to 
 edit files in an i386 environment, but the next step is to track down
 the definition of PRTR0MEMOBJFREEBSD, assuming that is the
 dereference giving the error on your system, and determining whether
 it ought to have the structure entry being dereferenced.

This takes me out of my depth in my very limited experience of C but would it 
be 
this, also in memobj-r0drv-freebsd.c:

 50 /**
 51  * The FreeBSD version of the memory object structure.
 52  */
 53 typedef struct RTR0MEMOBJFREEBSD
 54 {
 55 /** The core structure. */
 56 RTR0MEMOBJINTERNAL  Core;
 57 /** Type dependent data */
 58 /** The VM object associated with the allocation. */
 59 vm_object_t pObject;
 60 } RTR0MEMOBJFREEBSD, *PRTR0MEMOBJFREEBSD;

and then:

109 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)pMem;

[snip]

 You might want to try updating your system or trying the -legacy
 version of the port.

Version 4.1.8_1 seems to be working OK for me so I'll probably stick with that 
for 
the time being unless a fix turns up before I upgrade to 9.0-RELEASE which I'm 
planning to do shortly.

-- 
Mike Clarke
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Problem compiling emulators/virtualbox-ose-kmod 4.1.8_2

2012-03-21 Thread Lowell Gilbert
Bernhard Froehlich de...@freebsd.org writes:

 Pointyhat has triggered the same compile error so it is real. Probably
 avg has a clue how to fix it.

A (quick) look at pointyhat only shows me amd64 errors. 

My main build server (on amd64, building for i386 and amd64) doesn't see
those problems, and neither does my i386 sandbox. This seems to be quite
conditional, and I don't see much guidance as to what the conditions
need to be. As good as Andriy has been on keeping up, I can't provide a
debug case to solve for this problem. 

I'll try to come up with something more useful, but until/unless I can
reproduce the problem, I'm not sure how to make progress.

Be well.
.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Loan Offer...Apply Now

2012-03-21 Thread GE Capital Finance
Dear Email Owner,
 
We are presently offering loans to interested persons at an affordable rate 
with the help and assistance from our banks.we offer secured loans to 
individuals and companies at low interest, and we offer long and short term 
loans.

Our firm has recorded a lot of breakthroughs in the provision of first class 
financial services to our clients especially in the area of Loan and capital 
provision for individuals and companies.
 
You can apply for a fast loan here and get it with ease.Perhaps you need a loan 
for Debt Consolidation,Home Improvements,A New or Used Car Purchase,A New 
Home,Investment/Business Expansion Purposes, or Even a vacation.
 
In our loan scheme tagged 'loan under two weeks',every customer both local and 
international have the guarantee of obtaining a loan from this company on the 
mode of unsecured offshore international funding which means no collateral is 
required for this process.As you can see, cheap cash loans are the epitome of 
convenience! Take advantage of our online service and get your loan right away!
 
Interested persons should please furnish us with the following informations:
 
Name:
Contact Address/country:
Mobile Telephone Number:
Occupation:
Loan Amount:
Loan Duration:

We are here to help, if you are looking for cheap loans then you are in the 
right place! Simply fill in the form at the top of this page to enable us send 
an application form to you.

Transparency is what keep us on in the contest.

Regards,

Cynthia Dunzz
GE Capital Team


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org