[asterisk-bugs] [JIRA] (ASTERISK-24033) [patch]Extend STAT to check relative paths (for audio files)
Rusty Newton (JIRA)
noreply at issues.asterisk.org
Fri Jul 18 09:01:57 CDT 2014
[ https://issues.asterisk.org/jira/browse/ASTERISK-24033?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rusty Newton updated ASTERISK-24033:
------------------------------------
Summary: [patch]Extend STAT to check relative paths (for audio files) (was: Extend STAT to check relative paths (for audio files))
> [patch]Extend STAT to check relative paths (for audio files)
> ------------------------------------------------------------
>
> Key: ASTERISK-24033
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-24033
> Project: Asterisk
> Issue Type: Improvement
> Security Level: None
> Components: Functions/func_env
> Environment: any
> Reporter: M vd S
> Assignee: M vd S
> Severity: Trivial
>
> When playing sound files, I'd like to check existance *before* playing the file (i.e. not by checking Background() result or similar). I found STAT() to check file existance, but it only checks full paths. I think it would have "some extremely obvious (to many people) benefit" if STAT() would also understand relative paths like most sound/file-related functions do.
> The way I solved it, with a minimum of files/lines changed, was to add this to funcs/func_env.c in stat_read(), line 286:
> *\[EDIT: Inline code removed - mjordan\]*
> (see diff below)
> This is only a quick fix that only works for the e(xistance) check, and clearly doesn't recognize either "fmt" or "preflang" arguments to ast_fileexists().
> The distinction between relative and absolute paths is very clear so I don't see a risk of breaking existing installations. To be on the extreme safe side, the return statement can also be conditional on the positive result of ast_fileexists().
> I read the reasoning behind not allowing globbing in STAT (it was along the lines of "STAT() wraps the underlying stat() system call and should not do more"), which could also hold in this case, but I think most users would expect STAT to behave like other parts of Asterisk and allow relative filenames as well as absolute ones.
> Diff against latest svn:
> *\[EDIT: Inline code removed - mjordan\]*
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list