Open super1-chen opened 7 years ago
Thank you for your report!
I think I see what's happening here. fpm is instructed create a file called /usr/bin
(instead of what you intended, which was to create /usr/bin/redis-server
).
I don't know if we can automatically correct for this in all cases, but maybe I could add a list of known-directories that fpm would refuse this kind of action on?
How about trailing slash copies the basename of the file into the destination path, no trailing sets the destination file name to the path? Same behaviour as many standard tools that way so it's relatively intuitive. Rsync, mv, etc all work that way.
@hatt that is (or should be?) the behavior fpm has today already:
% fpm -s dir -t rpm -n noslash /usr/bin/ls=/usr/bin
Created package {:path=>"noslash-1.0-1.x86_64.rpm"}
% fpm -s dir -t rpm -n slash /usr/bin/ls=/usr/bin/
Created package {:path=>"slash-1.0-1.x86_64.rpm"}
% rpm -qvlp noslash-1.0-1.x86_64.rpm
-rwxr-xr-x 1 root root 128936 May 10 12:42 /usr/bin
% rpm -qvlp slash-1.0-1.x86_64.rpm
-rwxr-xr-x 1 root root 128936 May 10 12:42 /usr/bin/ls
I think fpm is behaving correctly, here, as shown above.
My concern is how easy it is for a someone to make a typo and end up with a very confusing package with no hints as to how it happened. If we can provide some hints (or warnings of some kind) about this, maybe this mistake can be caught during package build, instead of at package install time.
IMHO several issues appear that might be related to the path mapping feature, to a point where a GitHub label might be interesting to collect such issues. I'm facing such an issue where the left-hand side of '=' is NOT renamed into a right-hand side name in the package, but am not able to produce a good test case for that.
Hi:
I used redis-3.2.8 and run command
fpm -s dir -t deb -n redis --config-files /etc/redis/redis.conf -v 3.2.8 src/redis-server=/usr/bin redis.conf=/etc/redis/
after package created, there is no item./usr/bin/redis-server
then I installed the reids.deb package, get below error:sudo dpkg -i redis_3.2.8_amd64.deb [sudo] password for albert: Selecting previously unselected package redis. (Reading database ... 116560 files and directories currently installed.) Preparing to unpack redis_3.2.8_amd64.deb ... Unpacking redis (3.2.8) ... dpkg: error processing archive redis_3.2.8_amd64.deb (--install): trying to overwrite directory '/usr/bin' in package ruby 1:1.9.3.4 with nondirectory dpkg-deb: error: subprocess paste was killed by signal (Broken pipe) Errors were encountered while processing: redis_3.2.8_amd64.deb
I removed the redis_3.2.8_amd64.deb then run below command to create a new deb filefpm -s dir -t deb -n redis --config-files /etc/redis/redis.conf -v 3.2.8 src/redis-server=/usr/bin/redis-server redis.conf=/etc/redis/
the deb package worked well and I also got the
./usr/bin/redis-server
item when I rundpkg -c "redis-3.2.8_amd64.deb"
.please know that, thanks~