`/etc/shells` is read several times all over again
Using Debian Sid/unstable with accountsservice 0.6.45-2, running /usr/lib/accountsservice/accounts-daemon
under strace, it looks like /etc/shells
is read several times.
15:26:09.005295 execve("/usr/lib/accountsservice/accounts-daemon", ["/usr/lib/accountsservice/accounts-daemon"], 0x7ffc61b396e8 /* 7 vars */) = 0 <0.001263>
[…]
15:26:09.034411 openat(AT_FDCWD, "/etc/passwd", O_RDONLY) = 8 <0.000019>
15:26:09.034461 lseek(8, 0, SEEK_CUR) = 0 <0.000004>
15:26:09.034488 fstat(8, {st_mode=S_IFREG|0644, st_size=2320, ...}) = 0 <0.000236>
15:26:09.034754 read(8, "root:x:0:0:root:/root:/bin/bash\ndaemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin\nbin:x:2:2:bin:/bin:/usr/sbin/nologin\nsys:x:3:3:sys:/dev:/usr/sbin/nologin\nsync:x:4:65534:sync:/bin:/bin/sync\ngames:x:5:60:games:/usr/games:/usr/sbin/nologin\nman:x:6:12:man:/var/cache/man:/usr/sbin/nologin\nlp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin\nmail:x:8:8:mail:/var/mail:/usr/sbin/nologin\nnews:x:9:9:news:/var/spool/news:/usr/sbin/nologin\nuucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin\nproxy:x:13:13:proxy:/bin:/usr/sbin/nologin\nwww-data:x:33:33:www-data:/var/www:/usr/sbin/nologin\nbackup:x:34:34:backup:/var/backups:/usr/sbin/nologin\nlist:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin\nirc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin\ngnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin\nnobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin\n_apt:x:100:65534::/nonexistent:/usr/sbin/nologin\nsystemd-timesync:x:101:102:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin\nsystemd-"..., 4096) = 2320 <0.000038>
15:26:09.034832 lseek(8, 0, SEEK_CUR) = 2320 <0.000004>
15:26:09.034859 lseek(8, 0, SEEK_CUR) = 2320 <0.000004>
15:26:09.034883 lseek(8, 0, SEEK_CUR) = 2320 <0.000019>
15:26:09.034931 openat(AT_FDCWD, "/etc/shells", O_RDONLY|O_CLOEXEC) = 9 <0.000034>
15:26:09.034997 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000005>
15:26:09.035045 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000005>
15:26:09.035073 brk(0x559c9e52e000) = 0x559c9e52e000 <0.000007>
15:26:09.035104 read(9, "# /etc/shells: valid login shells\n/bin/sh\n/bin/bash\n/usr/bin/bash\n/bin/rbash\n/usr/bin/rbash\n/bin/dash\n/usr/bin/dash\n/usr/bin/screen\n", 4096) = 132 <0.000281>
15:26:09.035417 read(9, "", 4096) = 0 <0.000005>
15:26:09.035447 close(9) = 0 <0.000007>
15:26:09.035474 brk(0x559c9e52d000) = 0x559c9e52d000 <0.000016>
15:26:09.035521 lseek(8, 0, SEEK_CUR) = 2320 <0.000005>
15:26:09.035548 lseek(8, 0, SEEK_CUR) = 2320 <0.000004>
15:26:09.035573 lseek(8, 0, SEEK_CUR) = 2320 <0.000004>
15:26:09.035596 lseek(8, 0, SEEK_CUR) = 2320 <0.000004>
15:26:09.035619 lseek(8, 0, SEEK_CUR) = 2320 <0.000004>
15:26:09.035642 lseek(8, 0, SEEK_CUR) = 2320 <0.000004>
15:26:09.035665 lseek(8, 0, SEEK_CUR) = 2320 <0.000004>
15:26:09.035694 lseek(8, 0, SEEK_CUR) = 2320 <0.000006>
15:26:09.035725 openat(AT_FDCWD, "/etc/shells", O_RDONLY|O_CLOEXEC) = 9 <0.000014>
15:26:09.035762 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000005>
15:26:09.035788 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000004>
15:26:09.035812 read(9, "# /etc/shells: valid login shells\n/bin/sh\n/bin/bash\n/usr/bin/bash\n/bin/rbash\n/usr/bin/rbash\n/bin/dash\n/usr/bin/dash\n/usr/bin/screen\n", 4096) = 132 <0.000005>
15:26:09.035838 read(9, "", 4096) = 0 <0.000004>
15:26:09.035861 close(9) = 0 <0.000005>
15:26:09.035887 lseek(8, 0, SEEK_CUR) = 2320 <0.000004>
15:26:09.035923 openat(AT_FDCWD, "/etc/shells", O_RDONLY|O_CLOEXEC) = 9 <0.000011>
15:26:09.035955 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000004>
15:26:09.035981 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000004>
15:26:09.036405 read(9, "# /etc/shells: valid login shells\n/bin/sh\n/bin/bash\n/usr/bin/bash\n/bin/rbash\n/usr/bin/rbash\n/bin/dash\n/usr/bin/dash\n/usr/bin/screen\n", 4096) = 132 <0.000008>
15:26:09.036448 read(9, "", 4096) = 0 <0.000006>
15:26:09.036476 close(9) = 0 <0.000007>
15:26:09.036508 lseek(8, 0, SEEK_CUR) = 2320 <0.000006>
15:26:09.036559 openat(AT_FDCWD, "/etc/shells", O_RDONLY|O_CLOEXEC) = 9 <0.000096>
15:26:09.036686 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000005>
15:26:09.036714 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000004>
15:26:09.036738 read(9, "# /etc/shells: valid login shells\n/bin/sh\n/bin/bash\n/usr/bin/bash\n/bin/rbash\n/usr/bin/rbash\n/bin/dash\n/usr/bin/dash\n/usr/bin/screen\n", 4096) = 132 <0.000005>
15:26:09.036765 read(9, "", 4096) = 0 <0.000004>
15:26:09.036789 close(9) = 0 <0.000005>
15:26:09.036816 lseek(8, 0, SEEK_CUR) = 2320 <0.000005>
15:26:09.036840 openat(AT_FDCWD, "/etc/shells", O_RDONLY|O_CLOEXEC) = 9 <0.000011>
15:26:09.036872 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000004>
15:26:09.036908 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000004>
15:26:09.036934 read(9, "# /etc/shells: valid login shells\n/bin/sh\n/bin/bash\n/usr/bin/bash\n/bin/rbash\n/usr/bin/rbash\n/bin/dash\n/usr/bin/dash\n/usr/bin/screen\n", 4096) = 132 <0.000006>
15:26:09.036962 read(9, "", 4096) = 0 <0.000005>
15:26:09.036995 close(9) = 0 <0.000020>
15:26:09.037042 lseek(8, 0, SEEK_CUR) = 2320 <0.000005>
15:26:09.037069 openat(AT_FDCWD, "/etc/shells", O_RDONLY|O_CLOEXEC) = 9 <0.000017>
15:26:09.037109 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000006>
15:26:09.037135 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000005>
15:26:09.037162 read(9, "# /etc/shells: valid login shells\n/bin/sh\n/bin/bash\n/usr/bin/bash\n/bin/rbash\n/usr/bin/rbash\n/bin/dash\n/usr/bin/dash\n/usr/bin/screen\n", 4096) = 132 <0.000006>
15:26:09.037190 read(9, "", 4096) = 0 <0.000004>
15:26:09.037213 close(9) = 0 <0.000005>
15:26:09.037239 lseek(8, 0, SEEK_CUR) = 2320 <0.000004>
15:26:09.037262 openat(AT_FDCWD, "/etc/shells", O_RDONLY|O_CLOEXEC) = 9 <0.000011>
15:26:09.037293 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000004>
15:26:09.037333 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000006>
15:26:09.037362 read(9, "# /etc/shells: valid login shells\n/bin/sh\n/bin/bash\n/usr/bin/bash\n/bin/rbash\n/usr/bin/rbash\n/bin/dash\n/usr/bin/dash\n/usr/bin/screen\n", 4096) = 132 <0.000005>
15:26:09.037388 read(9, "", 4096) = 0 <0.000004>
15:26:09.037411 close(9) = 0 <0.000005>
15:26:09.037436 lseek(8, 0, SEEK_CUR) = 2320 <0.000004>
15:26:09.037460 lseek(8, 0, SEEK_CUR) = 2320 <0.000004>
15:26:09.037483 openat(AT_FDCWD, "/etc/shells", O_RDONLY|O_CLOEXEC) = 9 <0.000011>
15:26:09.037515 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000004>
15:26:09.037540 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000004>
15:26:09.037564 read(9, "# /etc/shells: valid login shells\n/bin/sh\n/bin/bash\n/usr/bin/bash\n/bin/rbash\n/usr/bin/rbash\n/bin/dash\n/usr/bin/dash\n/usr/bin/screen\n", 4096) = 132 <0.000005>
15:26:09.037589 read(9, "", 4096) = 0 <0.000004>
15:26:09.037611 close(9) = 0 <0.000005>
15:26:09.037635 lseek(8, 0, SEEK_CUR) = 2320 <0.000004>
15:26:09.037658 openat(AT_FDCWD, "/etc/shells", O_RDONLY|O_CLOEXEC) = 9 <0.000010>
15:26:09.037688 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000004>
15:26:09.037712 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000004>
15:26:09.037735 read(9, "# /etc/shells: valid login shells\n/bin/sh\n/bin/bash\n/usr/bin/bash\n/bin/rbash\n/usr/bin/rbash\n/bin/dash\n/usr/bin/dash\n/usr/bin/screen\n", 4096) = 132 <0.000005>
15:26:09.037760 read(9, "", 4096) = 0 <0.000004>
15:26:09.037782 close(9) = 0 <0.000005>
15:26:09.037807 lseek(8, 0, SEEK_CUR) = 2320 <0.000004>
15:26:09.037831 openat(AT_FDCWD, "/etc/shells", O_RDONLY|O_CLOEXEC) = 9 <0.000010>
15:26:09.037861 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000004>
15:26:09.037886 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000004>
15:26:09.037911 read(9, "# /etc/shells: valid login shells\n/bin/sh\n/bin/bash\n/usr/bin/bash\n/bin/rbash\n/usr/bin/rbash\n/bin/dash\n/usr/bin/dash\n/usr/bin/screen\n", 4096) = 132 <0.000013>
15:26:09.037950 read(9, "", 4096) = 0 <0.000005>
15:26:09.037976 close(9) = 0 <0.000016>
15:26:09.038051 lseek(8, 0, SEEK_CUR) = 2320 <0.000006>
15:26:09.038087 openat(AT_FDCWD, "/etc/shells", O_RDONLY|O_CLOEXEC) = 9 <0.000014>
15:26:09.038127 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000005>
15:26:09.038153 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000004>
15:26:09.038180 read(9, "# /etc/shells: valid login shells\n/bin/sh\n/bin/bash\n/usr/bin/bash\n/bin/rbash\n/usr/bin/rbash\n/bin/dash\n/usr/bin/dash\n/usr/bin/screen\n", 4096) = 132 <0.000007>
15:26:09.038210 read(9, "", 4096) = 0 <0.000005>
15:26:09.038234 close(9) = 0 <0.000006>
15:26:09.038260 lseek(8, 0, SEEK_CUR) = 2320 <0.000004>
15:26:09.038283 openat(AT_FDCWD, "/etc/shells", O_RDONLY|O_CLOEXEC) = 9 <0.000011>
15:26:09.038314 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000005>
15:26:09.038345 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000005>
15:26:09.038376 read(9, "# /etc/shells: valid login shells\n/bin/sh\n/bin/bash\n/usr/bin/bash\n/bin/rbash\n/usr/bin/rbash\n/bin/dash\n/usr/bin/dash\n/usr/bin/screen\n", 4096) = 132 <0.000005>
15:26:09.038407 read(9, "", 4096) = 0 <0.000004>
15:26:09.038433 close(9) = 0 <0.000005>
15:26:09.038460 lseek(8, 0, SEEK_CUR) = 2320 <0.000005>
15:26:09.038486 openat(AT_FDCWD, "/etc/shells", O_RDONLY|O_CLOEXEC) = 9 <0.000011>
15:26:09.038520 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000005>
15:26:09.038548 fstat(9, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0 <0.000005>
15:26:09.038575 read(9, "# /etc/shells: valid login shells\n/bin/sh\n/bin/bash\n/usr/bin/bash\n/bin/rbash\n/usr/bin/rbash\n/bin/dash\n/usr/bin/dash\n/usr/bin/screen\n", 4096) = 132 <0.000006>
15:26:09.038604 read(9, "", 4096) = 0 <0.000004>
15:26:09.038629 close(9) = 0 <0.000004>
[…]
Is that necessary? Can it be avoided or cached?