{"action":"created","issue":{"url":"https://api.github.com/repos/NixOS/nix/issues/1506","repository_url":"https://api.github.com/repos/NixOS/nix","labels_url":"https://api.github.com/repos/NixOS/nix/issues/1506/labels{/name}","comments_url":"https://api.github.com/repos/NixOS/nix/issues/1506/comments","events_url":"https://api.github.com/repos/NixOS/nix/issues/1506/events","html_url":"https://github.com/NixOS/nix/issues/1506","id":248796081,"number":1506,"title":"Running Nix under strace, I see lots of invalid close syscalls","user":{"login":"copumpkin","id":2623,"avatar_url":"https://avatars1.githubusercontent.com/u/2623?v=4","gravatar_id":"","url":"https://api.github.com/users/copumpkin","html_url":"https://github.com/copumpkin","followers_url":"https://api.github.com/users/copumpkin/followers","following_url":"https://api.github.com/users/copumpkin/following{/other_user}","gists_url":"https://api.github.com/users/copumpkin/gists{/gist_id}","starred_url":"https://api.github.com/users/copumpkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/copumpkin/subscriptions","organizations_url":"https://api.github.com/users/copumpkin/orgs","repos_url":"https://api.github.com/users/copumpkin/repos","events_url":"https://api.github.com/users/copumpkin/events{/privacy}","received_events_url":"https://api.github.com/users/copumpkin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-08-08T17:54:56Z","updated_at":"2017-08-08T17:57:30Z","closed_at":null,"body":"See here:\r\n\r\n```\r\n[pid 30244] prctl(PR_SET_SECCOMP, 0x2, 0xb04880, 0xffffffffffffff78, 0) = 0\r\n[pid 30244] chdir(\"/tmp/nix-build-foo-build.drv-0\") = 0\r\n[pid 30244] prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024*1024, rlim_max=1024*1024}) = 0\r\n[pid 30244] close(3)                    = 0\r\n[pid 30244] close(4)                    = 0\r\n[pid 30244] close(5)                    = 0\r\n[pid 30244] close(6)                    = 0\r\n[pid 30244] close(7)                    = 0\r\n[pid 30244] close(8)                    = 0\r\n[pid 30244] close(9)                    = 0\r\n[pid 30244] close(10)                   = 0\r\n[pid 30244] close(11)                   = 0\r\n[pid 30244] close(12)                   = 0\r\n[pid 30244] close(13)                   = 0\r\n[pid 30244] close(14)                   = 0\r\n[pid 30244] close(15)                   = 0\r\n[pid 30244] close(16)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(17)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(18)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(19)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(20)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(21)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(22)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(23)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(24)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(25)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(26)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(27)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(28)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(29)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(30)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(31)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(32)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(33)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(34)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(35)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(36)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(37)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(38)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(39)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(40)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(41)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(42)                   = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(43)                   = -1 EBADF (Bad file descriptor)\r\n... hundreds of thousands more lines ...\r\n[pid 30244] close(1048567)              = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(1048568)              = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(1048569)              = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(1048570)              = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(1048571)              = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(1048572)              = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(1048573)              = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(1048574)              = -1 EBADF (Bad file descriptor)\r\n[pid 30244] close(1048575)              = -1 EBADF (Bad file descriptor)\r\n[pid 30244] uname({sys=\"Linux\", node=\"70126c8570fa\", ...}) = 0\r\n[pid 30244] personality(0xffffffff /* PER_??? */) = 0\r\n[pid 30244] personality(0x40000 /* PER_??? */) = 0\r\n[pid 30244] setgroups(1, [30000])       = 0\r\n[pid 30244] setgid(30000)               = 0\r\n[pid 30244] getgid()                    = 30000\r\n[pid 30244] getegid()                   = 30000\r\n[pid 30244] setuid(30001)               = 0\r\n[pid 30244] getuid()                    = 30001\r\n[pid 30244] geteuid()                   = 30001\r\n[pid 30244] rt_sigaction(SIGPIPE, {SIG_DFL, [], SA_RESTORER, 0x7f83a4f9e840}, NULL, 8) = 0\r\n[pid 30244] write(2, \"\\1\\n\", 2)         = 2\r\n[pid 30240] <... read resumed> \"\\1\", 1) = 1\r\n[pid 30244] execve(\"/nix/store/y6mfysf2w7yx30bfyp9qk9br29qccwlw-bash-4.4-p12/bin/bash\", [\"bash\", \"-e\", \"/nix/store/9krlzvny65gdc8s7kpb6l\"...], [/* 22 vars */] <unfinished ...>\r\n[pid 30240] read(14, \"\\n\", 1)           = 1\r\n```\r\n\r\nI can't find anything obvious in the Nix source code that would cause that behavior, but I figured I'd point it out, since it seems like wasted effort.\r\n\r\nI'm on 1.11.13.\r\n\r\ncc @shlevy @domenkozar @edolstra "},"comment":{"url":"https://api.github.com/repos/NixOS/nix/issues/comments/321033576","html_url":"https://github.com/NixOS/nix/issues/1506#issuecomment-321033576","issue_url":"https://api.github.com/repos/NixOS/nix/issues/1506","id":321033576,"user":{"login":"copumpkin","id":2623,"avatar_url":"https://avatars1.githubusercontent.com/u/2623?v=4","gravatar_id":"","url":"https://api.github.com/users/copumpkin","html_url":"https://github.com/copumpkin","followers_url":"https://api.github.com/users/copumpkin/followers","following_url":"https://api.github.com/users/copumpkin/following{/other_user}","gists_url":"https://api.github.com/users/copumpkin/gists{/gist_id}","starred_url":"https://api.github.com/users/copumpkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/copumpkin/subscriptions","organizations_url":"https://api.github.com/users/copumpkin/orgs","repos_url":"https://api.github.com/users/copumpkin/repos","events_url":"https://api.github.com/users/copumpkin/events{/privacy}","received_events_url":"https://api.github.com/users/copumpkin/received_events","type":"User","site_admin":false},"created_at":"2017-08-08T17:57:30Z","updated_at":"2017-08-08T17:57:30Z","body":"Upon further inspection, this appears to be intentional: https://github.com/NixOS/nix/blob/1.11.13/src/libutil/util.cc#L1035-L1043\r\n\r\n\r\nI'll leave this open to make sure this is intentional."}}
{"actor":{"display_login":"copumpkin"}}