01-edu / public

📚 @01-edu's Public Repository
http://public.01-edu.org/
225 stars 448 forks source link

0-shell / job-control / audit [BUG] #2456

Closed DIGIX666 closed 4 months ago

DIGIX666 commented 7 months ago

Describe the bug

SCR-20240223-purh Screenshot 2024-02-23 at 17 54 06

Should the audit command be tar -czf ../home.tar.gz . & jobs because the command indicate compresses the archive which is itself

Users student : Thox66

Severity ⚠️ critical

Type ⚙️ functionality

To Reproduce Steps to reproduce the behavior:

  1. tar -czf home.tar.gz . & jobs
  2. See error

Workarounds Any known workarounds for the issue: tar -czf ../home.tar.gz . & jobs tar --exclude='home.tar.gz' -czf ../home.tar.gz . & jobs

Expected behavior I would like someone to confirm whether this is an error in the audit and correct it to validate the project.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Kevazy commented 7 months ago

Another student here, my interpretation of this audit question is:

  1. Run tar -czf home.tar.gz . & to put the job in the background (to test your "backgrounding" functionality)
  2. Run jobs to see your job running the background (to test if your jobs command is functioning correctly)
  3. Is it being displayed the same way as it does in the standard shell?

The & indicates the end of a command and causes it to execute asynchronously (in the background), but I understand the possible confusion in the question.

DIGIX666 commented 7 months ago

Hi Kévazy,

Thank you for your message. I had the same first interpretation but I get the same error

SCR-20240226-qgfh
Kevazy commented 7 months ago

Ah, previously I have only been running the shell/command using WSL (Ubuntu) and I noticed from your path you are running Windows. I tried the same with PowerShell and I get the same error, so the question is likely Unix or Linux-specific...

According to this page, Cygwin seems to be a decent Unix-like terminal for Windows in case you do not feel like going through the hassle of installing WSL on your machine. It should, in theory, use pretty much the same tar command as in actual Linux, but haven't tried it myself so no guarantees.

DIGIX666 commented 7 months ago

The path you see is what appears when I launch my go run . project. My device is a Mac, so I'm on Unix too. I'll look into it, maybe it's a problem in my code. Haven't you had this problem on your side?

Kevazy commented 7 months ago

Hmm, yeah, I am now realizing this is a weirder case than I initially thought.

Didn't notice it before since it didn't cause any problems on my side, but I am indeed getting this error on Linux, which I guess is similar to yours (in the way that it is trying to read/add itself) but handled differently by the OS as opposed to Mac.

❯ tar -czf home.tar.gz .
tar: .: file changed as we read it

It goes away the second time you run it, but that's most likely due to it already existing and not being bundled with anything new from the current folder. So basically, the command works "good enough" on Linux, but yeah I do see that you pretty much have to adapt it to your OS when it's being handled differently. Now better understanding the context, your workarounds definitely seem fair enough to pass the audit.

DIGIX666 commented 7 months ago

I think problem come to my OS (macOS) because I try this command in the shell linux (Ubuntu) and all it's good. I try in other device mac, same problem.

zanninso commented 6 months ago

Hello,

Can you confirm that you don't have any file named home.tar.gz in the location where you run the command ?

The error occurs due to discrepancies in the implementation of the tar command across different systems. However, the primary objective of the project is not to ensure the flawless execution of the command but rather to ensure that the command is added to the jobs correctly.

DIGIX666 commented 6 months ago

Hello,

I confirm, I don't have file named home.tar.gz before run a command tar -czf home.tar.gz . &

SCR-20240325-mdio-3
zanninso commented 6 months ago

Okay thanks for you feedback, This will be fixed

DIGIX666 commented 6 months ago

No problem ;)

When it's fixed can you please ping me