1 |
On Mon, Dec 28, 2020 at 8:09 PM Zac Medico <zmedico@g.o> wrote: |
2 |
> |
3 |
> On 12/28/20 3:15 PM, Matt Turner wrote: |
4 |
> > +def apply_keyword_changes(ebuild: str, pathname: str, |
5 |
> > + changes: List[Tuple[Optional[str], |
6 |
> > + Optional[str]]]) -> int: |
7 |
> > + result: int = 0 |
8 |
> > + |
9 |
> > + # ekeyword will only modify files named *.ebuild, so make a symlink |
10 |
> > + ebuild_symlink: str = os.path.basename(pathname) |
11 |
> > + os.symlink(ebuild, ebuild_symlink) |
12 |
> |
13 |
> Are we sure that the current working directory is an entirely safe place |
14 |
> to create this symlink? A simple fix would be to use |
15 |
> tempfile.TemporaryDirectory to create a temporary directory to hold the |
16 |
> symlink. Or, we could change ekeyword to assume that an argument is an |
17 |
> ebuild if os.path.isfile(arg) succeeds. |
18 |
|
19 |
Thanks, this is a good question. I've sent a v3 patch using |
20 |
tempfile.TemporaryDirectory. I think that's better than passing |
21 |
".merge_file_SEd3R8" to ekeyword since the filename is printed and |
22 |
it's nice to see what file is being modified during the rebase. |