Discussion:
cmus is not following symlinks when adding files
Markus Rothe
2013-04-21 13:46:29 UTC
Permalink
Hello,

I am using git-annex [1] to share my music folder between computers. The
result is that all files are symbolic links; i.e.:

% ls -l ~/music/Pink\ Floyd/1973\ -\ The\ Dark\ Side\ Of\ The\ Moon/01\ -\ Speak\ To\ Me\ -\ Breathe\ In\ The\ Air.flac
lrwxrwxrwx 1 markus markus 208 Apr 21 14:29 /home/markus/music/Pink Floyd/1973 - The Dark Side Of The Moon/01 - Speak To Me - Breathe In The Air.flac -> ../../.git/annex/objects/mW/3K/SHA256E-s18482470--a1f7a187936351006e0926bfd5db9de2fdb695f8f036d78f2ff86f8534319bb5.flac/SHA256E-s18482470--a1f7a187936351006e0926bfd5db9de2fdb695f8f036d78f2ff86f8534319bb5.flac

When adding the ~/music directory in cmus none of the files are added.
Could this please be changed, such that the files are added to the cmus
library.

I am using cmus 2.3.4.

Regards, Markus

[1] http://git-annex.branchable.com/
Gregory Petrosyan
2013-04-22 07:42:19 UTC
Permalink
Post by Markus Rothe
I am using git-annex [1] to share my music folder between computers. The
% ls -l ~/music/Pink\ Floyd/1973\ -\ The\ Dark\ Side\ Of\ The\ Moon/01\ -\ Speak\ To\ Me\ -\ Breathe\ In\ The\ Air.flac
lrwxrwxrwx 1 markus markus 208 Apr 21 14:29 /home/markus/music/Pink Floyd/1973 - The Dark Side Of The Moon/01 - Speak To Me - Breathe In The Air.flac -> ../../.git/annex/objects/mW/3K/SHA256E-s18482470--a1f7a187936351006e0926bfd5db9de2fdb695f8f036d78f2ff86f8534319bb5.flac/SHA256E-s18482470--a1f7a187936351006e0926bfd5db9de2fdb695f8f036d78f2ff86f8534319bb5.flac
When adding the ~/music directory in cmus none of the files are added.
Could this please be changed, such that the files are added to the cmus
library.
Cmus should have no problem with symlinks — are you sure your file is
accessible and playable, e.g. you can do

$ mplayer ~/music/Pink\ Floyd/1973\ -\ The\ Dark\ Side\ Of\ The\
Moon/01\ -\ Speak\ To\ Me\ -\ Breathe\ In\ The\ Air.flac

?
Post by Markus Rothe
I am using cmus 2.3.4.
Can you please upgrade to the latest version, either `master` branch
from git repository, or the 2.5.0 release? 2.3.4 is really ancient.

Gregory
Markus Rothe
2013-04-22 08:15:23 UTC
Permalink
Post by Gregory Petrosyan
Cmus should have no problem with symlinks — are you sure your file is
accessible and playable, e.g. you can do
$ mplayer ~/music/Pink\ Floyd/1973\ -\ The\ Dark\ Side\ Of\ The\
Moon/01\ -\ Speak\ To\ Me\ -\ Breathe\ In\ The\ Air.flac
Yes, that works.

I just noticed this:

- ":add ~/music" does not add anything.
- ":add ~/music/Pink Floyd/1973 - The Dark Side Of The Moon/01 - Speak
To Me - Breathe In The Air.flac" *does* add this one file.
Post by Gregory Petrosyan
Post by Markus Rothe
I am using cmus 2.3.4.
Can you please upgrade to the latest version, either `master` branch
from git repository, or the 2.5.0 release? 2.3.4 is really ancient.
I just built from the master branch and have the same problem.

-Markus
Vladimir Todorov
2013-04-22 08:21:03 UTC
Permalink
It looks similar to a problem I had once.
I didn't have the required packages before building cmus so I was not able
to add any song to it.
What is the output of the ./configure script?
Post by Markus Rothe
Cmus should have no problem with symlinks — are you sure your file is
accessible and playable, e.g. you can do
$ mplayer ~/music/Pink\ Floyd/1973\ -\ The\ Dark\ Side\ Of\ The\
Moon/01\ -\ Speak\ To\ Me\ -\ Breathe\ In\ The\ Air.flac
Yes, that works.
- ":add ~/music" does not add anything.
- ":add ~/music/Pink Floyd/1973 - The Dark Side Of The Moon/01 - Speak
To Me - Breathe In The Air.flac" *does* add this one file.
Post by Markus Rothe
I am using cmus 2.3.4.
Can you please upgrade to the latest version, either `master` branch
from git repository, or the 2.5.0 release? 2.3.4 is really ancient.
I just built from the master branch and have the same problem.
-Markus
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
Gregory Petrosyan
2013-04-22 08:22:36 UTC
Permalink
Post by Vladimir Todorov
It looks similar to a problem I had once.
I didn't have the required packages before building cmus so I was not able
to add any song to it.
What is the output of the ./configure script?
I don't think this is a problem here — since adding one file works
fine in this case.

Gregory
Markus Rothe
2013-04-22 08:26:13 UTC
Permalink
Post by Vladimir Todorov
It looks similar to a problem I had once.
I didn't have the required packages before building cmus so I was not able
to add any song to it.
What is the output of the ./configure script?
I do have the necessary libraries to play FLAC files:

$ ./configure prefix=/home/markus/temp/cmus-install
checking for program gcc... /usr/bin/gcc
checking for program gcc... /usr/bin/gcc
checking for CFLAGS -std=gnu99 -pipe -Wall -Wshadow -Wcast-align -Wpointer-arith -Wwrite-strings -Wundef -Wmissing-prototypes -Wredundant-decls -Wextra -Wno-sign-compare -Wformat-security... yes
checking for CFLAGS -Wdeclaration-after-statement... yes
checking for CFLAGS -Wold-style-definition... yes
checking for CFLAGS -Wno-pointer-sign... yes
checking for CFLAGS -Werror-implicit-function-declaration... yes
checking for CFLAGS -Wno-unused-parameter... yes
checking if CC can generate dependency information... yes
checking byte order... little-endian
checking for DL_LIBS (-ldl -Wl,--export-dynamic)... yes
checking for PTHREAD_LIBS (-lpthread)... yes
checking for realtime scheduling... yes
checking for NCURSES_LIBS (-lncursesw)... yes
checking for working ncurses setup... yes
checking for function resizeterm... yes
checking for function use_default_colors... yes
checking for ICONV_LIBS (-liconv)... no
assuming libc contains iconv
checking for working iconv... yes
checking for header <byteswap.h>... yes
checking for function strdup... yes
checking for function strndup... yes
checking for program pkg-config... /usr/bin/pkg-config
checking for CDDB_LIBS (pkg-config)... no
checking for CDDB_LIBS (-lcddb)... no
checking for CDIO_LIBS (pkg-config)... no
checking for CDIO_LIBS (-lcdio_cdio -lcdio -lm)... no
checking for FLAC_LIBS (pkg-config)... -lFLAC -lm
checking for FLAC_CFLAGS (pkg-config)... -I/usr/include/FLAC
checking for MAD_LIBS (pkg-config)... -lmad -lm
checking for MAD_CFLAGS (pkg-config)...
checking for MODPLUG_LIBS (pkg-config)... no
checking for MODPLUG_LIBS (-lmodplug -lstdc++ -lm)... no
checking for header <mpc/mpcdec.h>... no
checking for header <mpcdec/mpcdec.h>... no
checking for VORBIS_LIBS (pkg-config)... -lvorbisfile -lvorbis -lm -logg
checking for VORBIS_CFLAGS (pkg-config)...
checking for OPUS_LIBS (pkg-config)... no
*** Package opusfile was not found in the pkg-config search path.
*** Perhaps you should add the directory containing `opusfile.pc'
*** to the PKG_CONFIG_PATH environment variable
*** No package 'opusfile' found
checking for WAVPACK_LIBS (pkg-config)... no
checking for WAVPACK_LIBS (-lwavpack)... no
checking for header <mp4v2/mp4v2.h>... yes
checking for header <neaacdec.h>... yes
checking for MP4_LIBS (-lmp4v2 -lfaad -lm)... yes
checking for header <neaacdec.h>... yes
checking for AAC_LIBS (-lfaad -lm)... yes
checking for FFMPEG_LIBS (pkg-config)... -lavformat
checking for FFMPEG_CFLAGS (pkg-config)...
checking for header <libavcodec/avcodec.h>... yes
checking for successful build of ffmpeg.c... yes
checking for CUE_LIBS (pkg-config)... no
*** Package libcue was not found in the pkg-config search path.
*** Perhaps you should add the directory containing `libcue.pc'
*** to the PKG_CONFIG_PATH environment variable
*** No package 'libcue' found
checking for PULSE_LIBS (pkg-config)... no
*** Package libpulse was not found in the pkg-config search path.
*** Perhaps you should add the directory containing `libpulse.pc'
*** to the PKG_CONFIG_PATH environment variable
*** No package 'libpulse' found
checking for ALSA_LIBS (pkg-config)... -lasound
checking for ALSA_CFLAGS (pkg-config)... -I/usr/include/alsa
checking for AO_LIBS (pkg-config)... no
checking for AO_LIBS (-lao)... no
checking for program artsc-config... no
checking for header <sys/soundcard.h>... yes
checking for header <sys/audioio.h>... no
checking for ROAR_LIBS (pkg-config)... no
*** Package libroar was not found in the pkg-config search path.
*** Perhaps you should add the directory containing `libroar.pc'
*** to the PKG_CONFIG_PATH environment variable
*** No package 'libroar' found
creating config/cdio.h
creating config/datadir.h
creating config/libdir.h
creating config/debug.h
creating config/tremor.h
creating config/modplug.h
creating config/mpc.h
creating config/mp4.h
creating config/curses.h
creating config/ffmpeg.h
creating config/utils.h
creating config/iconv.h
creating config/xmalloc.h
creating config/cue.h
creating config.mk
Gregory Petrosyan
2013-04-22 08:38:36 UTC
Permalink
Post by Markus Rothe
- ":add ~/music" does not add anything.
- ":add ~/music/Pink Floyd/1973 - The Dark Side Of The Moon/01 - Speak
To Me - Breathe In The Air.flac" *does* add this one file.
Are `music`, `Pink Floyd` etc. real (non-symlink) directories? And
flac files are symlink with relative paths, right?

Gregory
Markus Rothe
2013-04-22 09:05:51 UTC
Permalink
Post by Gregory Petrosyan
Post by Markus Rothe
- ":add ~/music" does not add anything.
- ":add ~/music/Pink Floyd/1973 - The Dark Side Of The Moon/01 - Speak
To Me - Breathe In The Air.flac" *does* add this one file.
Are `music`, `Pink Floyd` etc. real (non-symlink) directories? And
flac files are symlink with relative paths, right?
Correct.
Gregory Petrosyan
2013-04-22 12:13:57 UTC
Permalink
Post by Markus Rothe
- ":add ~/music" does not add anything.
- ":add ~/music/Pink Floyd/1973 - The Dark Side Of The Moon/01 - Speak
To Me - Breathe In The Air.flac" *does* add this one file.
I can't reproduce the problem you are having — I've created a
directory with a (relative) symlink in it, leading outside the
directory, and cmus handles this scenario for me.

Can you please simplify the test case — try to repeat adding the
music, but e.g. one directory containing one (symlinked) file, and go
from there?

Gregory
Markus Rothe
2013-04-22 17:37:12 UTC
Permalink
Post by Gregory Petrosyan
Can you please simplify the test case — try to repeat adding the
music, but e.g. one directory containing one (symlinked) file, and go
from there?
You are correct. I also discovered that adding symlinked files works in
some cases. But here is a minimal testcase, which I cannot add by
running ":add ~/tmp/music/"; i.e. no files are added.

% tree ~/tmp/music -aN
/home/markus/tmp/music
|-- .content
| `-- 01 - Speak To Me - Breathe In The Air.flac
`-- Pink Floyd
`-- 1973 - The Dark Side Of The Moon
`-- 01 - Speak To Me - Breathe In The Air.flac -> ../../.content/01 - Speak To Me - Breathe In The Air.flac

3 directories, 2 files

[ .content would be .git in my case ]

Note that I *can* add it using ":add ~/tmp/music/Pink Floyd/".

-Markus
Gregory Petrosyan
2013-04-23 10:11:37 UTC
Permalink
Post by Markus Rothe
Post by Gregory Petrosyan
Can you please simplify the test case — try to repeat adding the
music, but e.g. one directory containing one (symlinked) file, and go
from there?
You are correct. I also discovered that adding symlinked files works in
some cases. But here is a minimal testcase, which I cannot add by
running ":add ~/tmp/music/"; i.e. no files are added.
% tree ~/tmp/music -aN
/home/markus/tmp/music
|-- .content
| `-- 01 - Speak To Me - Breathe In The Air.flac
`-- Pink Floyd
`-- 1973 - The Dark Side Of The Moon
`-- 01 - Speak To Me - Breathe In The Air.flac -> ../../.content/01 - Speak To Me - Breathe In The Air.flac
3 directories, 2 files
[ .content would be .git in my case ]
Note that I *can* add it using ":add ~/tmp/music/Pink Floyd/".
Oh! I think I understand the problem now. Thanks a lot for the test case.

Can you please test if the code at my `symlink-fix` branch
(https://github.com/flyingmutant/cmus/tree/symlink-fix) works?

Gregory
Markus Rothe
2013-04-23 11:30:49 UTC
Permalink
Post by Gregory Petrosyan
Oh! I think I understand the problem now. Thanks a lot for the test case.
Can you please test if the code at my `symlink-fix` branch
(https://github.com/flyingmutant/cmus/tree/symlink-fix) works?
Yes, it is working fine now. Thanks a lot! :-)

-Markus
Jason Woofenden
2013-04-23 20:17:42 UTC
Permalink
This is a very cool bug!

The cause is that cmus doesn't add the contents of invisible
folders, and it ignores symlinks that point within the folder its
adding (to avoid adding those tracks twice.)

In this use case, we discovered that we need an exception to the
"ignore internal symlinks" rule above, so that symlinks to hidden
folders/files are heeded.

Thank you Markus for reporting and testing, and Gregory for
figuring out the bug and fixing it!


I was curious why I was not experiencing this bug, given that my
music is stored in git-annex too. But now it makes sense: my annex
is not within my music folder.
--
Jason
Loading...