{"action":"created","issue":{"url":"https://api.github.com/repos/jordansissel/fpm/issues/586","labels_url":"https://api.github.com/repos/jordansissel/fpm/issues/586/labels{/name}","comments_url":"https://api.github.com/repos/jordansissel/fpm/issues/586/comments","events_url":"https://api.github.com/repos/jordansissel/fpm/issues/586/events","html_url":"https://github.com/jordansissel/fpm/issues/586","id":22765312,"number":586,"title":"Incorrect \"File exists\" message when building.","user":{"login":"frozenfoxx","id":495325,"avatar_url":"https://avatars.githubusercontent.com/u/495325?v=3","gravatar_id":"","url":"https://api.github.com/users/frozenfoxx","html_url":"https://github.com/frozenfoxx","followers_url":"https://api.github.com/users/frozenfoxx/followers","following_url":"https://api.github.com/users/frozenfoxx/following{/other_user}","gists_url":"https://api.github.com/users/frozenfoxx/gists{/gist_id}","starred_url":"https://api.github.com/users/frozenfoxx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frozenfoxx/subscriptions","organizations_url":"https://api.github.com/users/frozenfoxx/orgs","repos_url":"https://api.github.com/users/frozenfoxx/repos","events_url":"https://api.github.com/users/frozenfoxx/events{/privacy}","received_events_url":"https://api.github.com/users/frozenfoxx/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jordansissel/fpm/labels/confirmed","name":"confirmed","color":"0052cc"},{"url":"https://api.github.com/repos/jordansissel/fpm/labels/deb","name":"deb","color":"444444"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2013-11-15T23:14:02Z","updated_at":"2015-02-26T07:04:43Z","closed_at":null,"body":"When attempting to build a package from files I incorrectly get a \"file exists\" message when the listed-directory doesn't exist:\r\n\r\n```\r\n frozenfoxx@machine:~/transfer/redis-2.6.16$ fpm -s dir -t deb -n redis --config-files /etc/redis/redis.conf -v 2.6.16 ./src/redis-server=/usr/bin redis.conf=/etc/redis/redis.conf ./src/redis-cli=/usr/bin/redis-cli ./src/redis-benchmark=/usr/bin/redis-benchmark ./src/redis-sentinel=/usr/bin/redis-sentinel ./src/redis-check-aof=/usr/bin/redis-check-aof ./src/redis-check-dump=/usr/bin/redis-check-dump\r\n /usr/lib/ruby/1.9.1/fileutils.rb:247:in `mkdir': File exists - /tmp/package-dir-staging20131114-10360-1oqbkys/usr/bin (Errno::EEXIST)\r\n        from /usr/lib/ruby/1.9.1/fileutils.rb:247:in `fu_mkdir'\r\n        from /usr/lib/ruby/1.9.1/fileutils.rb:221:in `block (2 levels) in mkdir_p'\r\n        from /usr/lib/ruby/1.9.1/fileutils.rb:219:in `reverse_each'\r\n        from /usr/lib/ruby/1.9.1/fileutils.rb:219:in `block in mkdir_p'\r\n        from /usr/lib/ruby/1.9.1/fileutils.rb:205:in `each'\r\n        from /usr/lib/ruby/1.9.1/fileutils.rb:205:in `mkdir_p'\r\n        from /var/lib/gems/1.9.1/gems/fpm-0.4.42/lib/fpm/package/dir.rb:132:in `copy'\r\n        from /var/lib/gems/1.9.1/gems/fpm-0.4.42/lib/fpm/package/dir.rb:113:in `clone'\r\n        from /var/lib/gems/1.9.1/gems/fpm-0.4.42/lib/fpm/package/dir.rb:67:in `block in input'\r\n        from /var/lib/gems/1.9.1/gems/fpm-0.4.42/lib/fpm/package/dir.rb:66:in `chdir'\r\n        from /var/lib/gems/1.9.1/gems/fpm-0.4.42/lib/fpm/package/dir.rb:66:in `input'\r\n        from /var/lib/gems/1.9.1/gems/fpm-0.4.42/lib/fpm/command.rb:294:in `block in execute'\r\n        from /var/lib/gems/1.9.1/gems/fpm-0.4.42/lib/fpm/command.rb:293:in `each'\r\n        from /var/lib/gems/1.9.1/gems/fpm-0.4.42/lib/fpm/command.rb:293:in `execute'\r\n        from /var/lib/gems/1.9.1/gems/clamp-0.6.3/lib/clamp/command.rb:67:in `run'\r\n        from /var/lib/gems/1.9.1/gems/clamp-0.6.3/lib/clamp/command.rb:125:in `run'\r\n        from /var/lib/gems/1.9.1/gems/fpm-0.4.42/bin/fpm:8:in `<top (required)>'\r\n        from /usr/local/bin/fpm:23:in `load'\r\n        from /usr/local/bin/fpm:23:in `<main>'\r\n```"},"comment":{"url":"https://api.github.com/repos/jordansissel/fpm/issues/comments/76131796","html_url":"https://github.com/jordansissel/fpm/issues/586#issuecomment-76131796","issue_url":"https://api.github.com/repos/jordansissel/fpm/issues/586","id":76131796,"user":{"login":"jordansissel","id":131818,"avatar_url":"https://avatars.githubusercontent.com/u/131818?v=3","gravatar_id":"","url":"https://api.github.com/users/jordansissel","html_url":"https://github.com/jordansissel","followers_url":"https://api.github.com/users/jordansissel/followers","following_url":"https://api.github.com/users/jordansissel/following{/other_user}","gists_url":"https://api.github.com/users/jordansissel/gists{/gist_id}","starred_url":"https://api.github.com/users/jordansissel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jordansissel/subscriptions","organizations_url":"https://api.github.com/users/jordansissel/orgs","repos_url":"https://api.github.com/users/jordansissel/repos","events_url":"https://api.github.com/users/jordansissel/events{/privacy}","received_events_url":"https://api.github.com/users/jordansissel/received_events","type":"User","site_admin":false},"created_at":"2015-02-26T07:04:43Z","updated_at":"2015-02-26T07:04:43Z","body":"ok, so the problem is \"technically\" user error, but the error message you get is terrible.\r\n\r\nThe problem is that, at least in fpm's view, the dir mapping `./src/redis-server=/usr/bin` says to copy the file \"redis-server\" and put it in /usr as a file named \"bin\" so you end up with \"/usr/bin\" as a file that is the redis-server binary. Oops.\r\n\r\nThe fix is to add a trailing /:\r\n`./src/redis-server=/usr/bin/`\r\n\r\nI've tried to follow rsync's behavior with respect to source/destination copies, and rsync does this also:\r\n\r\n```\r\n% mkdir -p /tmp/usr/\r\n% rsync src/redis-server /tmp/usr/bin\r\n% ls -ld /tmp/usr/bin\r\n-rwxr-xr-x  1 jls  wheel  806520 Feb 25 23:03 /tmp/usr/bin*\r\n```\r\n\r\nOn the other hand, this behavior is ... surprising ... to say the least, even if we can explain the reasons behind it. I'm not sure what exactly to do about it."}}