Closed Bug 1299530 Opened 9 years ago Closed 9 years ago

TraceLogger: Remove outdated redirection file when renaming

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: sfink, Assigned: sfink)

References

Details

Attachments

(1 file)

I think I ran into a problem where I renamed something, and it kept looking for the old file.
Comment on attachment 8786790 [details] [diff] [review] TraceLogger: Remove outdated redirection file when renaming Review of attachment 8786790 [details] [diff] [review]: ----------------------------------------------------------------- ::: tools_v2/rename.py @@ +99,5 @@ > with open(new_redir_file, "w") as fp: > fp.write("\"%s.json\"" % basename(new_name)) > + if not os.path.samefile(redir_file, new_redir_file): > + if not args.keep: > + os.remove(redir_file) Isn't that what is happening on line 95? 5 lines before this code? I moved it to that place to make sure we didn't remove it after creating it here. As a result I think this code is obsolete?
Attachment #8786790 - Flags: review?(hv1989)
(In reply to Hannes Verschore [:h4writer] from comment #2) > Comment on attachment 8786790 [details] [diff] [review] > TraceLogger: Remove outdated redirection file when renaming > > Review of attachment 8786790 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: tools_v2/rename.py > @@ +99,5 @@ > > with open(new_redir_file, "w") as fp: > > fp.write("\"%s.json\"" % basename(new_name)) > > + if not os.path.samefile(redir_file, new_redir_file): > > + if not args.keep: > > + os.remove(redir_file) > > Isn't that what is happening on line 95? 5 lines before this code? > I moved it to that place to make sure we didn't remove it after creating it > here. > As a result I think this code is obsolete? Oh! Sorry, I assumed that it got dropped in the merge, and didn't notice you'd moved it up. My general reasoning is that when initially using this stuff, I was getting errors in the middle of the renaming, but it had already deleted some stuff and so I was left with mangled directory contents. So this was an application of the general "delete as late as possible, in case something went wrong." (And yeah, I noticed that this might delete the file you just created, and specifically checked for that.) But the only way I can see that this would fail is if you run out of disk space or there were permissions problems or something, and you'd almost certainly error out earlier. So I think you're right, we can just drop this patch. Your version is simpler since it can skip the os.path.samefile check.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: