#22 datestr->secs breaks bagatto on FreeBSD 1 year, 7 months ago

Comment by ~mieum on ~subsetpark/bagatto

However, it should be totally optional - you should be able to write a function that shells out to whatever other command you need, and you shouldn’t need to invoke this one.

Have you encountered otherwise? You say that Bagatto can’t be used—is there somewhere that the whole program breaks as a result of the different format? If so, that is probably a bug and I’ll definitely try to fix it.

Ah. I see! In that case I do not think this completely breaks it for FreeBSD. I made that assumption because I was trying to familiarize myself with bagatto by building the example sites in the demo folder (along with the source of your own blog) and kept running into this. It is not a big deal to write a custom function for my own use...that's part of the fun anyway! It may be worth noting in the docs, however, just so people are aware.

#22 datestr->secs breaks bagatto on FreeBSD 1 year, 7 months ago

on ~subsetpark/bagatto

Hi there-

Thank you for the kind words. Unfortunately, as last I checked, there was no native method to convert between the two, and thus this rather ugly hack.

However, it should be totally optional - you should be able to write a function that shells out to whatever other command you need, and you shouldn’t need to invoke this one.

Have you encountered otherwise? You say that Bagatto can’t be used—is there somewhere that the whole program breaks as a result of the different format? If so, that is probably a bug and I’ll definitely try to fix it.

On Mon, Jul 31, 2023 at 9:51 PM ~mieum outgoing@sr.ht wrote:

Hello!

I have discovered that bagatto cannot be used on FreeBSD due to the use of a flag to date that is not available on that system (the -d flag to be precise). Trying to run bag index.janet fails with the following error:

date: illegal option -- d
usage: date [-jnRu] [-I[date|hours|minutes|seconds]] [-f input_fmt]
            [-r filename|seconds] [-v[+|-]val[y|m|w|d|H|M|S]]
            [[[[[[cc]yy]mm]dd]HH]MM[.SS] | new_date] [+output_fmt]
error: Distribute error:
Encountered error getting attrs for data spec posts:

command(s) (@[date -d "2022-12-02" "+%s"]) failed, exit code(s) @[1].
  in errorf [boot.janet] on line 169, column 3
  in distribute-gather [src/threads.janet] (tailcall) on line 39, column 22
  in main [main.janet] on line 52, column 23

The equivalent flag on FreeBSD is -r, but in fact the syntax is slightly different. Is there no way to convert between datestrings and seconds in the janet standard library? I am not yet very familiar with janet, but if I can find the time I will mess with this and submit a patch!

Thanks! I really love the project!

-- View on the web: https://todo.sr.ht/~subsetpark/bagatto/22

#22 datestr->secs breaks bagatto on FreeBSD 1 year, 7 months ago

Ticket created by ~mieum on ~subsetpark/bagatto

Hello!

I have discovered that bagatto cannot be used on FreeBSD due to the use of a flag to date that is not available on that system (the -d flag to be precise). Trying to run bag index.janet fails with the following error:

date: illegal option -- d
usage: date [-jnRu] [-I[date|hours|minutes|seconds]] [-f input_fmt]
            [-r filename|seconds] [-v[+|-]val[y|m|w|d|H|M|S]]
            [[[[[[cc]yy]mm]dd]HH]MM[.SS] | new_date] [+output_fmt]
error: Distribute error: 
Encountered error getting attrs for data spec posts:

command(s) (@[date -d "2022-12-02" "+%s"]) failed, exit code(s) @[1].
  in errorf [boot.janet] on line 169, column 3
  in distribute-gather [src/threads.janet] (tailcall) on line 39, column 22
  in main [main.janet] on line 52, column 23

The equivalent flag on FreeBSD is -r, but in fact the syntax is slightly different. Is there no way to convert between datestrings and seconds in the janet standard library? I am not yet very familiar with janet, but if I can find the time I will mess with this and submit a patch!

Thanks! I really love the project!