You are not logged in.

#26 2013-08-26 00:03:49

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,492
Website

Re: shaman - A small C program to fetch weather

Alright, I have a question for anyone who uses this as I'm not sure quite how I feel about this. I went back and looked at weatherman again for the first time in a while and I remembered Supplantr's question about allowing more flexible formatting. I am now contemplating (after I finish implementing the official To-Do list) switching to a format-code printing system like weatherman.

So far, the way I see it are as follows:

Pros
  • Users have complete control over what gets printed and how it looks

  • Current formatting conventions for `-a` could be easily preserved (and improved) with a default format

  • Should make use in a statusbar script (shaman's original purpose) much simpler and more versatile

Cons
  • May require a large increase in code

  • Functionality beyond cosmetics will largely be unchanged

Tl;dr: How many people would like to see shaman switch to a format-code printing system? Do you have any arguments to add to my pros and cons lists?

All the best,

-HG


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#27 2013-08-27 01:39:01

bslackr
Member
Registered: 2012-01-27
Posts: 131

Re: shaman - A small C program to fetch weather

Either way is good for me.

Offline

#28 2013-08-27 07:17:55

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,492
Website

Re: shaman - A small C program to fetch weather

Another fairly big update.

The latest commit includes fixing a printing bug for hazardous weather alerts, slightly changing the syntax for a config file, and finally adding support for specifying a location using "City, ST" syntax.

Config files should now be formatted like so:

Location="location"
Units="U"

Notice that location can now be either be a zipcode or "City, ST", and U can still either be "M" or "I".

Next up will be to add 7-day forecasts which is not difficult, but just tedious (lots of fscaning and printing). So, soon, hopefully, I should be able to start on the full migration to native implementations which should lead to some really fun benefits.

All the best,

-HG

Last edited by HalosGhost (2013-08-27 07:18:38)


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#29 2013-08-28 18:16:10

Supplantr
Member
From: a state of sunshine
Registered: 2011-12-12
Posts: 149
Website

Re: shaman - A small C program to fetch weather

My vote is for a format code printing system. wink

Also, when -z is the last option passed, this happens:

% shaman 33410 -z

Lat: 0, Lon: 0, Elev: 0

Condition: 
Temperature: 0°F
Heat Index: -42.4°F
Wind: Negligible
Humidity: 0%
Dew Point: 0°F
Visibility: 0 mi
Pressure: 0 in

I use linux and I dont understand nothing in this post.

Offline

#30 2013-08-28 19:51:10

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,492
Website

Re: shaman - A small C program to fetch weather

Supplantr wrote:

My vote is for a format code printing system. wink

I'm not surprised, haha. This is still a ways off, but that might be a fun learning experience, so I imagine I may do this afterall.

Also, when -z is the last option passed, this happens

The location should always be the last argument passed.

All the best,

-HG


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#31 2013-09-07 18:06:55

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,492
Website

Re: shaman - A small C program to fetch weather

Update:

I have very little need at the moment for a 7-day forecast, and as it is outside the scope of shaman being for primary use with a statusbar script, I've dropped plans on including it. (This is partially because the formatting of NOAA's xml makes parsing for a 7-day forecast a bit of a nightmare). If people are dead-set on wanting it, I will revisit it again once I have successfully implemented libcurl so shaman can be completely native C.

All the best,

-HG


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#32 2013-11-30 02:20:56

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,492
Website

Re: shaman - A small C program to fetch weather

Okay folks, sorry for the really long break in updates and development. Here's the story. I feel much more confident in my coding abilities, and upon looking at my old code for shaman, I was rather embarrassed. So, shaman 2.0 is now in the works. It will be recoded from the ground, up. It will use C's getopt library so argument parsing and handling will be much more sensible along with the libconfig library so the config file will be handled much better.

I'm also happy to announce that it will use libcurl for the fetching, so it will be completely native C, and I will switch over to an strftime-like format string for printing.

The end result of all these efforts will (hopefully) be that shaman 2.0 will be a much more light-weight, powerful and polished product that is much more usable in status bars (it's original purpose).

The work for recoding has just begun, and I am still working on my Bachelor's Thesis, so don't hold your breath. I am, however, very excited to get this thing up to snuff.

[Edit]: The branches on the git page have been updated to reflect the new development direction. In the meantime, the ALUR package has been updated to use the legacy branch since the 2.x version is no where near ready for use.

All the best,

-HG

Last edited by HalosGhost (2013-11-30 02:48:48)


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#33 2013-11-30 03:59:38

cris9288
Member
Registered: 2013-01-07
Posts: 348

Re: shaman - A small C program to fetch weather

Hi HalosGhost! This is pretty nice; I just stuck it in my conky configuration. One thing I'd like to mention is that it appears shaman depends on libconfig, which I did not have. I'm not sure how common of a library that is for users to have installed, but, in my case building failed on account of there being no libconfig.h file anywhere. It was trivial to just install it and rebuild, but I thought that maybe you'd be interested in knowing.

Other than that, thanks for all your work on this!

Offline

#34 2013-11-30 04:11:13

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,492
Website

Re: shaman - A small C program to fetch weather

cris9288 wrote:

Hi HalosGhost! This is pretty nice; I just stuck it in my conky configuration. One thing I'd like to mention is that it appears shaman depends on libconfig, which I did not have. I'm not sure how common of a library that is for users to have installed, but, in my case building failed on account of there being no libconfig.h file anywhere. It was trivial to just install it and rebuild, but I thought that maybe you'd be interested in knowing.

Ahh, yes, that's my bad. I was working on updating 1.x for libconfig and libcurl, but I never completed it. I will update the legacy source shortly so you won't need them. Sorry about the trouble.

[Edit]: Alright, the unneeded libs (libcurl and libconfig) have been removed from the legacy code.

All the best,

-HG

Last edited by HalosGhost (2013-11-30 19:51:00)


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#35 2013-12-23 10:23:52

mhogomchungu
Member
Registered: 2013-03-29
Posts: 86

Re: shaman - A small C program to fetch weather

just looked at your code and i have a few suggestions.

1. Dont use "strncpy()"[1],instead use "snprintf()[2]

[1] http://www.cplusplus.com/reference/cstring/strncpy/
[2] http://www.cplusplus.com/reference/cstdio/snprintf/

the reason is that snprintf() guarantees that your strings will be NULL terminated while strncpy() does not.

It is possible for example to cause your program to have undefined behaviors by passing -l and -f arguments with strings containing more than 80 characters.

2.You have "formatString" variable declared as a char buffer of size 80,you do not do "strlen(formatString)" to get the size of the buffer,you do "sizeof(formatString)".

example,instead of doing:

            strncpy(passLoc, optarg, 80);

do

            strncpy(passLoc, optarg, sizeof(passLoc));

but a better alternative is:

          snprintf(passLoc,sizeof(passLoc),"%s",optarg);

instead of doing:

	    	strncpy(url, provider, strlen(provider));
		strncat(url, location, 255-strlen(provider));

do

          snprintf( url,sizeof(url),"%s%s%s",url,provider,location) ;

Last edited by mhogomchungu (2013-12-23 10:24:39)

Offline

#36 2013-12-23 15:17:08

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,492
Website

Re: shaman - A small C program to fetch weather

mhogomchungu wrote:

just looked at your code and i have a few suggestions.

1. Dont use "strncpy()"[1],instead use "snprintf()[2]

[1] http://www.cplusplus.com/reference/cstring/strncpy/
[2] http://www.cplusplus.com/reference/cstdio/snprintf/

the reason is that snprintf() guarantees that your strings will be NULL terminated while strncpy() does not.

It is possible for example to cause your program to have undefined behaviors by passing -l and -f arguments with strings containing more than 80 characters.

This sounds entirely reasonable and much safer. Though, if you pass either argument containing over 80 characters, the same thing will likely happen under either method—libcurl will fail to fetch the correct source.

2.You have "formatString" variable declared as a char buffer of size 80,you do not do "strlen(formatString)" to get the size of the buffer,you do "sizeof(formatString)".

Yep, not a bad idea either.

Thanks for the suggestions! I'm still plugging away at getting 2.x functional, and I've rewritten the string copying sections to use snprintf (which is turning out to be much nicer). In the future though, don't be afraid to submit a pull request. smile

All the best,

-HG

Last edited by HalosGhost (2013-12-23 16:09:31)


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#37 2013-12-23 21:13:31

mhogomchungu
Member
Registered: 2013-03-29
Posts: 86

Re: shaman - A small C program to fetch weather

will make a pull request in the future,in the mean time,a few more suggestions

char provider[] = "http://forecast.weather.gov/zipcity.php?inputstring=",
     formatString[80] = "",
	 passLoc[80] = "",
	 tempweather[] = "/tmp/weather.xml";

I think is better if each variable should have its own type declaration.
I think its better if you do not use writable buffers to hold those string constants since you do not intend to modify them.
I think its better if you use constants variables for buffer sizes

I think the above code snippet should be like below

#define BUFFER_SIZE 80

const char* provider = "http://forecast.weather.gov/zipcity.php?inputstring=" ;
const char* tempweather = "/tmp/weather.xml";

char  formatString[BUFFER_SIZE] = {'\0'} ;
char	 passLoc[BUFFER_SIZE] = {'\0'} ;
	 

The "tempweather" variable creates a bad side effect[4].You should minimize it by having your application create the temporary file in a user's home directory,better solution is not to create the temporary file at all and do everything in memory by using "curl_easy_setopt()" with "CURLOPT_WRITEFUNCTION" option.

Its better to not pollute global namespace by declaring your functions as static and prefix them with an underscope to show they are static functions.
const correctness[1] also dictates that "parseFile()" and "getData()" should take a const pointer since they do not modify the buffer their arguments point to.

static void _usage(void);
static void _getData(const char *location);
static void _parseFile(const char *tempweather);
static void _parseData(xmlDocPtr weather, xmlNodePtr cur);
static void _formatOutput(char *formatStr);

I would also recommend not using global variables.Easy to follow code has a known point where an object is created,first used,last used and destroyed.Global variables makes it hard to know the above and make code hard to reason with.

Your code has odd formatting.You can know more about different proffered formats from this link[2].
You can use this tool[3] to help you format your code.

The above may seem "pedantic" on such small code base but its always a good idea to develop and use good habits regardless of code size.

[1] http://en.wikipedia.org/wiki/Const-correctness
[2] http://en.wikipedia.org/wiki/Indent_style
[3] https://www.archlinux.org/packages/?sor … =&flagged=
[4] http://en.wikipedia.org/wiki/Side_effec … science%29

Last edited by mhogomchungu (2013-12-23 21:23:52)

Offline

#38 2013-12-24 04:29:50

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,492
Website

Re: shaman - A small C program to fetch weather

mhogomchungu wrote:

will make a pull request in the future,in the mean time,a few more suggestions
<snip>

Awesome! I'm still getting comfortable with C, so the code (though it has improved significantly in quality since the initial release) is still not terribly pretty.

The "tempweather" variable creates a bad side effect[4].You should minimize it by having your application create the temporary file in a user's home directory,better solution is not to create the temporary file at all and do everything in memory by using "curl_easy_setopt()" with "CURLOPT_WRITEFUNCTION" option.

This is actually just a temporary solution. I'm hoping to, eventually, be able to support Windows too, so /tmp was never intended to be present all the time. The thing is, the NWS actually has an API that I just recently stumbled upon (it's actually not very obvious unless you search for it explicitly). So, eventually, when I support the remote API, shaman won't even fetch the dwml file upstream.

And, I'll take a look at astyle, that looks quite helpful.

All the best,

-HG


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#39 2014-01-03 06:46:42

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,492
Website

Re: shaman - A small C program to fetch weather

Hey folks, another small update. Thanks to some help from mhogomchungu, the libcurl code now grabs the file in a buffer rather than writing it to the filesystem at all. This will be incredibly helpful when I support the upstream API since that interaction will still require fetching a dwml file (it will just be one generated at run-time). The next bit of work to do is the dirty work, parsing the format string to determine the elements to use and then run the necessary conversions. Though, at the moment, only one function exists for this process (_formatOutput), I imagine there will actually be two (one to read the string so shaman knows what to ask for in the fetched file, and the other to run the conversions on the string and return it to the user). I may end up taking the plunge and just trying to support the API from the get-go. Pros of doing this are upstream-compliance and fetching only the data you want (which means better speed for users fetching less data). Cons are that the final version will be a ways away from even being testable since I'll need to do all the API-compatibility work.

I still haven't decided which way I will go, but I will say that I will support the API in the long-run. One other final note for this update. I removed all ability to add a config file to shaman. I originally planned to use libconfig in an effort to make the config syntax and use (both by the end-user and by the code itself) much simpler. However, it finally dawned on me that 100 percent of the options that could be set in shaman's config (there were only three) were all available on the command-line through arguments. Furthermore, since shaman now uses C's getopt library, it takes advantage of argument precedence; that is, if you pass an option multiple times, only the last iteration will be applied. This means that a simple shell alias completely deprecates a config and saves me all the code. TL;DR, use a shell alias, and don't worry about a config.

[Edit]: All right, it's looking more and more like I'm going to go all out and support the upstream API for the next release. The main reason for this is because cURL can be used to send SOAP client requests which is all that's really needed for me to be API-compliant. This means the next step is to parse the format string to determine what information is desired. Next up is to setup and send the SOAP request for the requested data. Once we've requested and received the data, we parse it and then run through the format string again and run the conversions. I honestly don't know how long these will take, but I'll get started on the first bit shortly. As always, comments, questions, concerns and pull requests are welcome.

All the best,

-HG

Last edited by HalosGhost (2014-01-05 04:55:22)


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#40 2014-06-14 07:26:47

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,492
Website

Re: shaman - A small C program to fetch weather

Okay, phew! A lot has happened in the last two and a half months (I even graduated college!). I am sorry for the huge delay in updates, and longer delay in new code. I wouldn't be surprised if users out there were starting to feel like shaman 2.x was little more than vaporware. I am, however, here to say that such is not the case! There have been some huge changes to the project as a whole, and to how I was going about particular things.

For example, shaman will no longer use the National Weather Service for its weather data. In its place, shaman will use* OpenWeatherMap. There is a whole laundry list of reasons why this decision was made, but let me give you the highlights:

  1. XML Parsing under C is a mess, and even the prototype code for it added several hundred lines of code

  2. OWM supports a JSON interface which is much simpler to query and parse

  3. OWM draws its data from multiple places to support nearly 80,000 cities all across the globe. This means that shaman will no longer be a US-only utility.

  4. One of OWM's data sources is the National Weather Service; so US users should see almost no degredation in quality of weather data

Over the last month or so, I have had the chance to sit down with OWM and begin the work of rewriting shaman from the ground-up (again!). The work is not done. But a lot of progress has been made:

  • A native C library (libweather) has largely been completed (it's no where near stable, nor finalized; but it's getting there)

  • All the heavy lifting is already being done by native libraries (libcurl to fetch the data, libjansson to parse it)

  • A minimal test suite is in the works so that tracking down code breakage should be much simpler in the future; this will be coupled with the addition of Travis-CI to the repo for continuous integration

libweather already correctly requests and receives data from OWM and correctly parses it (mostly). Now, I'm in the trenches writing the function to pull it all together. There are still some helper functions that need to be added before the library really becomes stable and usable, but I can see the light at the end of the tunnel. Over the next few days, the github repo will be updated to reflect the huge overhaul, and I hope to have the code building and testable in short-order.

Now, none of the documentation has been touched since this recode began. Don't worry. As soon as the library reaches a fairly stable point, I will begin rewriting the documentation. Finally, I want to thank you all for your patience and understanding; it's going to pay off.

* Oh, by the way, because I have really taken a much deeper inspiration from strftime()/`date` than for shaman 1.x, the library uses a source-agnostic struct for storing the data. As a result, though the initial version of the library will only support OpenWeatherMap, it may very well eventually grow to support a wide variety of weather providers!

All the best,

-HG


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#41 2014-06-16 05:59:12

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,492
Website

Re: shaman - A small C program to fetch weather

All right! libweather is now handling a huge portion of the initial planned feature set. A lot of the error handling still must be defined and written, but well-formed calls should now function okay. More interesting for end-users is that there is now a shaman binary to test! Not all of the initial planned feature set is implemented yet, but it's on its way. I will update the PKGBUILD in the ALUR in the next day or two so that folks interested in testing can jump in and start building.

In the meantime, if you would like to give it a whirl anyway, build it with the following:

$ ./autogen.sh
$ ./configure --prefix='<prefix where you want it installed; default is '/usr/local'>'
$ make
# make install

Locations must have spaces URL-encoded, so a valid call looks something like the following:

$ shaman -l 'Saint Paul,US' -f '%c (%t°F)'

That fetches data for Saint Paul and outputs the current weather conditions followed by the current temperature in parentheses.

The library now uses curl's function for escaping a string to URL encoding (notice that you don't need to do weird things like "%20", as in the modified example above, anymore). Also, early adopters, rejoice—the package has been updated! For the record, the format specifiers aren't really to my liking at the moment, so they are all subject to change. I am hoping to finalize them (mostly) before I package the documentation.

After the library handles a few more things (e.g., encoding the location correctly so users don't have to do so manually), and the package is updated, I'll get to work on updating the documentation so the format codes won't be so elusive.

Edit: The format specifiers have now reached a (tentatively) sensible and finalized (for now) state. And, there is now a preliminary man page included for shaman!

All the best,

-HG

Last edited by HalosGhost (2014-06-18 00:29:24)


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#42 2014-06-18 21:52:32

Trilby
Forum Fellow
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 16,909
Website

Re: shaman - A small C program to fetch weather

HG, I'm just trying this out again - I installed shaman-git via the AUR PKGBUILD.  It will display help - but anything else just immediately segfaults.  I'll leave out the plain segfault message below, but all of these commands segfault with no other output:

shaman 01075
shaman -l 01075
shaman "Boston,MA"
shaman "Boston,US"
shaman -l "Boston,MA"
shaman -l "Boston,US"
... plus the last 4 with spaces after the comma
... plus every iteration of New York NY or New York US

Under gdb I get this info:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff78acd0a in strlen () from /usr/lib/libc.so.6

I'll recompile with symbols and see if I can get some more info (edit: scratch that, I have no idea how to do that with autotools!)

Last edited by Trilby (2014-06-18 21:53:52)

Offline

#43 2014-06-18 21:55:17

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 22,718
Website

Re: shaman - A small C program to fetch weather

shaman -l Boston,US -m -f "%t°C with %c."
28.37°C with Sky is Clear.

smile


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

#44 2014-06-18 21:59:45

Trilby
Forum Fellow
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 16,909
Website

Re: shaman - A small C program to fetch weather

That also works here - but it seems the format string parameter is required - without it I get the segfaults.

In trying to track this down I noticed something else: the three lines under "case 'l'" in shaman.c can be replaced by a single strdup().

I see the man page says there is a default format if it's not specified, but I can't see that this is set anywhere in the code.  You may also want to initialize your char *'s to NULL so you can check if they were set.

Adding the following right after the getopt loop works (assuming the char pointers are initialized to NULL):

if (!format) format = strdup("%c (%t°F)");

Last edited by Trilby (2014-06-18 22:22:01)

Offline

#45 2014-06-19 00:59:47

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,492
Website

Re: shaman - A small C program to fetch weather

Trilby, yes, the format parameter is still required, else it segfaults (the same is true of the location). This is mainly because shaman is still incredibly alpha, and not even remotely all the features are implemented (I still need to finish the definition and standardization of libweather). I'm already aware of the bug, I just haven't gotten around to fixing it. big_smile The man page is very preliminary.

Note that development really only got deeply underway in the last week and a half tongue

All the best,

-HG

P.S., at least for the moment, OWM doesn't actually support searching by zip code. So, though you will be able to search by city name or by a numeric ID that OWM uses internally, you will not be able to use a zipcode as a location.

P.P.S., great heads-up about strdup(), I was unaware of it.

Edit: Segfaults upon not specifying a location or format are fixed; The format I mention in the man page is now used as a fallback.

Last edited by HalosGhost (2014-06-19 02:14:09)


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#46 2014-06-26 23:20:04

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,492
Website

Re: shaman - A small C program to fetch weather

Another big update folks.

Shaman is now teetering on the edge of becoming what I would consider to be friendly for average users. All that needs to happen for that to be the case is for me to finalize one more thing for caching/freshening and then get the error-handling up to snuff. The shaman man-page is now actually pretty much up-to-date, and most everything works as-expected.

Working forward, I have some serious restructuring to do so that adding extra providers will be easy (I already have a plan, and it shouldn't be too hard). However, the majority of the changes during the next little bit (unless people really step up their feature-requesting) will probably be more important for developers that are interested in using shaman's backend rather than front-end users. Anyone interested in testing should consider going ahead!

All the best,

-HG


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#47 2014-06-28 02:28:05

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: shaman - A small C program to fetch weather

HalosGhost wrote:

Segfaults upon not specifying a location or format are fixed; The format I mention in the man page is now used as a fallback.

What about not specifying the cache location?

$ shaman -m -l "<city>,PL"
Determining if cache should be freshened failed: Permission denied
Segmentation fault
$ shaman -m -l "<city>,PL" -c $HOME/.shaman/cache.json
Sky is Clear (10°C)

The man page led me to believe that I need to specify the location only if it's a non-standard one:

Shaman will look for the cache in the following locations stopping upon the first file found:

       $XDG_CONFIG_HOME/shaman/cache.json
       $HOME/.shaman/cache.json

Offline

#48 2014-06-28 02:32:11

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,492
Website

Re: shaman - A small C program to fetch weather

karol wrote:
$ shaman -m -l "<city>,PL"
Determining if cache should be freshened failed: Permission denied
Segmentation fault
$ shaman -m -l "<city>,PL" -c $HOME/.shaman/cache.json
Sky is Clear (10°C)

That is very interesting, and not something that is applicable to my system (I use $XDG_CONFIG_HOME). It works correctly for me (as it finds $XDG_CONFIG_HOME/shaman/cache.json and uses it just fine). Can you show me the output of `ls -l $HOME/.shaman/cache.json`?

All the best,

-HG


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#49 2014-06-28 02:42:42

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: shaman - A small C program to fetch weather

$ ls -l $HOME/.shaman/cache.json
-rw-r--r-- 1 karol users 2048 Jun 28 04:29 /home/karol/.shaman/cache.json

Offline

#50 2014-06-28 02:45:54

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,492
Website

Re: shaman - A small C program to fetch weather

karol wrote:
$ ls -l $HOME/.shaman/cache.json
-rw-r--r-- 1 karol users 2048 Jun 28 04:29 /home/karol/.shaman/cache.json

Well then, that narrows down where the issue is a little (and it's definitely an upstream issue). Would you mind opening a bug on GitHub, and I'll get to work on this now?

All the best,

-HG


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

Board footer

Powered by FluxBB