nikolassv / bartib

A simple timetracker for the command line. It saves a log of all tracked activities as a plaintext file and allows you to create flexible reports.
GNU General Public License v3.0
636 stars 34 forks source link

[Bug] Problem with defining log file #49

Closed imhosseinzadeh closed 4 months ago

imhosseinzadeh commented 4 months ago

Hi, thanks for development of this useful CLI tool. I had a problem using the Bartib in the early steps, so I decided to open this issue.

When i define the log file with bartib -f /home/iman/activities.bartib report after calling start i get Error: Could not write to file: /home/iman/activities.bartib

but export BARTIB_FILE="/home/iman/activities.bartib" works fine.

I installed Bartib by cloning the project and building with cargo, then moved binary output to /usr/local/bin.

nikolassv commented 4 months ago

This is a curious error that may be hard to reproduce. In general, it should make no difference whether you specify the file via the -f parameter or via the environment parameter.

Could you share some more information on your system?

imhosseinzadeh commented 4 months ago

i faced problem on Fedora 39, and now testing it again on Ubuntu 22.04.3 LTS and it occurred again. I attach output.

Screenshot from 2024-02-15 15-40-26

nikolassv commented 4 months ago

In the screenshot, I do not see anything unexpected. What output does bartib start -f /home/iman/activities.bartib -d "test" -p "test" yield? What are the file permissions of the activities.bartib file?

imhosseinzadeh commented 4 months ago

stat activities.bartib:

  File: activities.bartib
  Size: 0           Blocks: 0          IO Block: 4096   regular empty file
Device: 815h/2069d  Inode: 333577      Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/    iman)   Gid: ( 1000/    iman)
Access: 2024-02-15 15:37:28.755726614 +0330
Modify: 2024-02-15 15:36:56.412074169 +0330
Change: 2024-02-15 15:36:56.412074169 +0330
 Birth: 2024-02-15 15:36:56.412074169 +0330

bartib start -f /home/iman/activities.bartib -d "test" -p "test" output:

error: Found argument '-f' which wasn't expected, or isn't valid in this context

USAGE:
    bartib start [OPTIONS] --description <DESCRIPTION> --project <PROJECT>

For more information try --help
nikolassv commented 4 months ago

Sorry, my mistake. The command should have been: bartib -f /home/iman/activities.bartib start -d "test" -p "test" with the -f option before the subcommand. Could you try that again?

The permissions on the activities.bartib file look good.

imhosseinzadeh commented 4 months ago

worked fine

iman@iman-H81M:~/bartib/target/release$ bartib -f /home/iman/activities.bartib start -d "test" -p "test"
Started activity: "test" (test) at 2024-02-15 19:03
nikolassv commented 4 months ago

So, are you still able to reproduce the initial error?

imhosseinzadeh commented 4 months ago

the Error: Please specify a file with your activity log either as -f option or as BARTIB_FILE environment variable is produced again, if i execute bartib stop

imhosseinzadeh commented 4 months ago

I think it's useful if you can compile the last commit and test it on a virtual machine.

nikolassv commented 4 months ago

Ok, but that is to be expected when neither the -f option or the environment variable is set. That's not a bug.

Have you been able to reproduce the error Error: Could not write to file: /home/iman/activities.bartib. That is the one that I cannot explain.

nikolassv commented 4 months ago

I am sorry, but I am unable to reproduce the bug. I suspect the issue has something to do with your system setup, although I can not imagine which circumstances may lead to it.

I will close this issue. Feel free to open it again, if you can describe the steps to reproduce the initial bug. I would be happy to have a look at it.