mworrell on l10n_master
mworrell on master
New Crowdin updates (#3287) (compare)
michielklonhammer on l10n_master
New translations zotonic.pot (R… (compare)
michielklonhammer on l10n_master
New translations zotonic.pot (R… (compare)
DorienD on master
mod_mailinglist: add acl check … (compare)
michielklonhammer on l10n_master
New translations zotonic.pot (R… (compare)
m_identity:get_user_info(1, C).
:(zotonic@ns208588)6> m_identity:get_user_info(1, C).
13:01:47.789 [info] z_db_pgsql:{286,5} SQL caller <0.1992.0> down with reason normal during on xxx/public: "
select key, visited, prop1, modified
from identity
where rsc_id = $1
and type = 'username_pw'" []
** exception error: no function clause matching lists:zip([int4],[]) (lists.erl, line 391)
in function epgsql:equery/4 (/home/zotonic/zotonic/_build/default/lib/epgsql/src/epgsql.erl, line 263)
in call from z_db_pgsql:equery/4 (/home/zotonic/zotonic/apps/zotonic_core/src/db/z_db_pgsql.erl, line 126)
in call from z_db:'-q/4-fun-0-'/5 (/home/zotonic/zotonic/apps/zotonic_core/src/db/z_db.erl, line 566)
in call from timer:tc/2 (timer.erl, line 181)
in call from z_db:with_connection/3 (/home/zotonic/zotonic/apps/zotonic_core/src/db/z_db.erl, line 318)
in call from z_db:q_row/3 (/home/zotonic/zotonic/apps/zotonic_core/src/db/z_db.erl, line 606)
in call from m_identity:get_user_info/2 (/home/zotonic/zotonic/apps/zotonic_core/src/models/m_identity.erl, line 241)
{function_clause,[{z_convert,to_binary,[{19324}],[{file,"/home/zotonic/zotonic/_build/default/lib/zotonic_stdlib/src/
z_convert.erl"},{line,99}]},{z_search_terms,add_or_append,3,[{file,"/home/zotonic/zotonic/apps/zotonic_core/src/
support/z_search_terms.erl"},{line,269}]},{lists,foldl,3,[{file,"lists.erl"},{line,1267}]},{z_search_terms,combine,
2,[{file,"/home/zotonic/zotonic/apps/zotonic_core/src/support/z_search_terms.erl"},{line,164}]},{z_search_terms,
combine,1,[{file,"/home/zotonic/zotonic/apps/zotonic_core/src/support/z_search_terms.erl"},{line,39}]},
{z_search_terms,combine,1,[{file,"/home/zotonic/zotonic/apps/zotonic_core/src/support/z_search_terms.erl"},
{line,33}]},{z_search,handle_search_result,7,[{file,"/home/zotonic/zotonic/apps/zotonic_core/src/support/
z_search.erl"},{line,224}]},{z_search,search_pager,4,[{file,"/home/zotonic/zotonic/apps/zotonic_core/src/
support/z_search.erl"},{line,125}]}]}
.local/…/files/backup
and they look fine
Dir = z_path:files_subdir_ensure("backup", Context).
=> returns the correct directory = okFiles = z_utils:wildcard(filename:join(Dir, "*.sql")).
=> empty arrayfilename:join(Dir, "*.sql”).
=> path/to/site//files/backup/*.sql
= okz_utils:wildcard(filename:join(Dir, "*.sql")).
=> empty array
In mod_backup
line 412
:
Files = z_utils:wildcard(filename:join(dir(Context), "*.sql")),
concatenates the full directory path with the wildcard. This results in an empty array.
But when calling z_utils:wildcard/2
(with the directory as 2nd parameter), it works correctly:
Files = z_utils:wildcard("*.sql", dir(Context)),
z_utils:filter_dot_files
removes the files with a dot, and the path contains .local/
, so...
filelib:find_file/3
was added. We could have a look to see if that brings any benefit for this. Otherwise restricting the wildcard to something which matches the backup filename a bit more restrictive than *.sql
. (Did a rm -rf * .o
in a project once. It cleaned up the directory pretty well, but ot didn't help to meet the deadline)
find_file/3
is not for this kind of stuff. OTP 23 added https://www.erlang.org/doc/man/filelib.html#safe_relative_path-2 though to prevent traversal attacks... Including .git
is logical I think. Although not strictly needed if the pattern against the backup files are a little bit more strict and contain the date pattern. The module can otherwise accidentally delete aribtrary .sql files.
2022-01-04 00:26:07.698 [error] <0.26448.8> Cowboy stream 1 with ranch listener zotonic_https_listener_ipv4
and connection process <0.26442.8> had its request process exit with reason: {nocatch,{stop_request,500,
{function_clause,[{cowmachine_util,parse_qs_name,[<<"=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000">>,[],<<>>],[
{file,"/home/zotonic/zotonic/_build/default/lib/cowmachine/src/cowmachine_util.erl"},{line,284}]},
{z_context,ensure_qs,1,[{file,"/home/zotonic/zotonic/apps/zotonic_core/src/support/z_context.erl"},{line,
523}]},{z_cowmachine_middleware,'-execute/2-fun-0-',1,[{file,"/home/zotonic/zotonic/apps/zotonic_core/src/
support/z_cowmachine_middleware.erl"},{line,54}]},{cowmachine_decision_core,...},...]}}} in
cowmachine_decision_core:handle_request/2 line 40