aboutcode-org / aboutcode-org/scancode-toolkit

files opened many times during scanning

未关闭
#3,347 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
Python
星标
2.6k
派生
791
平均合并
1 天 12 小时
30 天内合并 PR
5

描述

### Description

When running scancode with `strace` I can see that every file is opened 4 or 5 times and also read as many times accordingly. A small (filtered) snippet of `strace` output:

```
...
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/rzip.c", O_RDONLY|O_NONBLOCK) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/rzip.c", O_RDONLY|O_NONBLOCK) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/rzip.c", O_RDONLY|O_CLOEXEC) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/rzip.c", O_RDONLY|O_CLOEXEC) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/rzip.c", O_RDONLY|O_CLOEXEC) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/rzip.h", O_RDONLY|O_NONBLOCK) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/rzip.h", O_RDONLY|O_NONBLOCK) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/rzip.h", O_RDONLY|O_CLOEXEC) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/rzip.h", O_RDONLY|O_CLOEXEC) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/rzip.h", O_RDONLY|O_CLOEXEC) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/rzip.yo", O_RDONLY|O_NONBLOCK) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/rzip.yo", O_RDONLY|O_NONBLOCK) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/rzip.yo", O_RDONLY|O_CLOEXEC) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/rzip.yo", O_RDONLY|O_CLOEXEC) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/rzip.yo", O_RDONLY|O_CLOEXEC) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/rzipall", O_RDONLY|O_NONBLOCK) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/rzipall", O_RDONLY|O_NONBLOCK) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/rzipall", O_RDONLY|O_CLOEXEC) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/rzipall", O_RDONLY|O_CLOEXEC) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/stream.c", O_RDONLY|O_NONBLOCK) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/stream.c", O_RDONLY|O_NONBLOCK) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/stream.c", O_RDONLY|O_CLOEXEC) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/stream.c", O_RDONLY|O_CLOEXEC) = 4
[pid 392633] openat(AT_FDCWD, "/tmp/rzip-2.1/stream.c", O_RDONLY|O_CLOEXEC) = 4
...

```

This seems a bit excessive. I haven't yet tried with really large files, but if these are also read multiple times (instead of data being shared between scans) it could get quite expensive.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。