Skip to content

Commit 3fb90e9

Browse files
committed
Remove file ignore filter to use -B flag instead
1 parent eb64d2a commit 3fb90e9

File tree

4 files changed

+3
-24
lines changed

4 files changed

+3
-24
lines changed

config/.ignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

config/snekbox.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,5 @@ iface_no_lo: true
117117

118118
exec_bin {
119119
path: "/usr/local/bin/python"
120-
arg: "-Squ"
120+
arg: "-BSqu"
121121
}

snekbox/memfs.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
import logging
55
import warnings
66
import weakref
7-
from collections.abc import Generator, Sequence
7+
from collections.abc import Generator
88
from contextlib import suppress
9-
from fnmatch import fnmatch
109
from pathlib import Path
1110
from types import TracebackType
1211
from typing import Type
@@ -125,7 +124,6 @@ def files(
125124
self,
126125
limit: int,
127126
pattern: str = "**/*",
128-
ignores: Sequence[str] = (),
129127
exclude_files: dict[Path, float] | None = None,
130128
) -> Generator[FileAttachment, None, None]:
131129
"""
@@ -134,20 +132,12 @@ def files(
134132
Args:
135133
limit: The maximum number of files to parse.
136134
pattern: The glob pattern to match files against.
137-
ignores: A sequence of fnmatch patterns to ignore.
138135
exclude_files: A dict of Paths and last modified times.
139136
Files will be excluded if their last modified time
140137
is equal to the provided value.
141138
"""
142139
count = 0
143140
for file in self.output.rglob(pattern):
144-
if any(
145-
fnmatch(str(file.relative_to(self.home)), match_pattern := ignore_pattern)
146-
for ignore_pattern in ignores
147-
):
148-
log.info(f"Ignoring {file.name!r} as it matches {match_pattern!r}")
149-
continue
150-
151141
if exclude_files and (orig_time := exclude_files.get(file)):
152142
new_time = file.stat().st_mtime
153143
log.info(f"Checking {file.name} ({orig_time=}, {new_time=})")
@@ -168,7 +158,6 @@ def files_list(
168158
self,
169159
limit: int,
170160
pattern: str,
171-
ignores: Sequence[str] = (),
172161
exclude_files: dict[Path, float] | None = None,
173162
preload_dict: bool = False,
174163
) -> list[FileAttachment]:
@@ -178,7 +167,6 @@ def files_list(
178167
Args:
179168
limit: The maximum number of files to parse.
180169
pattern: The glob pattern to match files against.
181-
ignores: A sequence of fnmatch patterns to ignore.
182170
exclude_files: A dict of Paths and last modified times.
183171
Files will be excluded if their last modified time
184172
is equal to the provided value.
@@ -187,7 +175,7 @@ def files_list(
187175
List of FileAttachments sorted lexically by path name.
188176
"""
189177
res = sorted(
190-
self.files(limit=limit, pattern=pattern, ignores=ignores, exclude_files=exclude_files),
178+
self.files(limit=limit, pattern=pattern, exclude_files=exclude_files),
191179
key=lambda f: f.path,
192180
)
193181
if preload_dict:

snekbox/nsjail.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ def __init__(
5858
files_limit: int | None = 100,
5959
files_timeout: float | None = 8,
6060
files_pattern: str = "**/[!_]*",
61-
files_ignore_path: str = "./config/.ignore",
6261
):
6362
"""
6463
Initialize NsJail.
@@ -75,8 +74,6 @@ def __init__(
7574
files_limit: Maximum number of output files to parse.
7675
files_timeout: Maximum time in seconds to wait for output files to be read.
7776
files_pattern: Pattern to match files to attach within the output directory.
78-
files_ignore_path: Path to a file containing a gitignore-like list of file
79-
patterns to ignore for upload.
8077
"""
8178
self.nsjail_path = nsjail_path
8279
self.config_path = config_path
@@ -89,7 +86,6 @@ def __init__(
8986
self.files_limit = files_limit
9087
self.files_timeout = files_timeout
9188
self.files_pattern = files_pattern
92-
self.files_ignores = Path(files_ignore_path).read_text().splitlines()
9389

9490
self.config = self._read_config(config_path)
9591
self.cgroup_version = utils.cgroup.init(self.config)
@@ -275,7 +271,6 @@ def python3(
275271
MemFS.files_list,
276272
(fs, self.files_limit, self.files_pattern),
277273
{
278-
"ignores": self.files_ignores,
279274
"preload_dict": True,
280275
"exclude_files": files_written,
281276
},

0 commit comments

Comments
 (0)