jbmestelan / nyxt

Nyxt - Be productive.
https://nyxt.atlas.engineer
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Sweep: function 'load-file' does not consider symbolic links #1

Closed jbmestelan closed 1 year ago

jbmestelan commented 1 year ago

On Linux, if a file or directory is a symlink, it is not considered by 'load-file' function.

sweep-ai[bot] commented 1 year ago

Here's the PR! https://github.com/jbmestelan/nyxt/pull/3.

⚡ Sweep Free Trial: I used GPT-4 to create this ticket. You have 5 GPT-4 tickets left for the month and 0 for the day. For more GPT-4 tickets, visit our payment portal.To get Sweep to recreate this ticket, leave a comment prefixed with "sweep:" or edit the issue.


Step 1: 🔍 Code Search

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/jbmestelan/nyxt/blob/98ff8a4f56b9f8bd01dd58cd983c24c4e2364992/source/start.lisp#L431-L596 https://github.com/jbmestelan/nyxt/blob/98ff8a4f56b9f8bd01dd58cd983c24c4e2364992/source/start.lisp#L191-L287 https://github.com/jbmestelan/nyxt/blob/98ff8a4f56b9f8bd01dd58cd983c24c4e2364992/source/mode/history.lisp#L63-L225 https://github.com/jbmestelan/nyxt/blob/98ff8a4f56b9f8bd01dd58cd983c24c4e2364992/nyxt.asd#L8-L92 https://github.com/jbmestelan/nyxt/blob/98ff8a4f56b9f8bd01dd58cd983c24c4e2364992/source/start.lisp#L74-L151

Step 2: 🧐 Snippet Analysis

From looking through the relevant snippets, I decided to make the following modifications:

File Path Proposed Changes
source/start.lisp Modify the 'load-file' function to call 'truename' on the pathname before attempting to load the file. This can be done by replacing the line that loads the file (likely a call to the 'load' function) with a call to 'load' that takes the result of calling 'truename' on the pathname as its argument.

Step 3: 📝 Planning

I have created a plan for writing the pull request. I am now working my plan and coding the required changes to address this issue. Here is the planned pull request:

Fix issue with 'load-file' function not considering symbolic links sweep/fix-load-file-symbolic-links

Description

This PR fixes the issue with the 'load-file' function in the Nyxt browser not considering symbolic links. The current implementation does not resolve symbolic links to their actual location before attempting to load the file, resulting in the function not recognizing symbolic links.

To address this issue, the 'load-file' function has been modified to call the Common Lisp function 'truename' on the pathname before attempting to load the file. This ensures that the actual location of the file is loaded, even if the pathname is a symbolic link.

Summary of Changes

  • Modified the 'load-file' function in the 'start.lisp' file to call 'truename' on the pathname before loading the file.
  • Replaced the line that loads the file with a call to 'load' that takes the result of calling 'truename' on the pathname as its argument.

These changes ensure that the 'load-file' function correctly handles symbolic links and loads the actual location of the file.


Step 4: ⌨️ Coding

File Instructions Progress
source/start.lisp Modify the 'load-file' function to call 'truename' on the pathname before attempting to load the file. This can be done by replacing the line that loads the file (likely a call to the 'load' function) with a call to 'load' that takes the result of calling 'truename' on the pathname as its argument. ✅ Commit a5ac6f4 I have finished coding the issue. I am now reviewing it for completeness.

Step 5: 🔁 Code Review

Here are the my self-reviews of my changes at sweep/fix-load-file-symbolic-links.

Here is the 1st review

No changes required. The use of the truename function to ensure the use of absolute file paths when loading Lisp files is a good practice, especially when dealing with remote processes. Keep up the good work!

I finished incorporating these changes.


To recreate the pull request, leave a comment prefixed with "sweep:" or edit the issue. Join Our Discord