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)
/admin/edit/1
etc. (all user pages):05:36:08.696 [error] at: "cowmachine:request_1:86", code: 500, dst: #{ip4 => "94.23.6.14",port => 443}, in: cowmachine, level: error, path: <<"/admin/edit/1">>, reason: function_clause, src: #{ip4 => "213.93.222.193",port => 60197}, stacktrace: [{lists,zip,[[int4],[]],[{file,"lists.erl"},{line,391}]},{epgsql,equery,4,[{file,"/home/zotonic/zotonic/_build/default/lib/epgsql/src/epgsql.erl"},{line,263}]},{z_db_pgsql,equery,4,[{file,"/home/zotonic/zotonic/apps/zotonic_core/src/db/z_db_pgsql.erl"},{line,126}]},{z_db,'-q/4-fun-0-',5,[{file,"/home/zotonic/zotonic/apps/zotonic_core/src/db/z_db.erl"},{line,566}]},{timer,tc,2,[{file,"timer.erl"},{line,181}]},{z_db,with_connection,3,[{file,"/home/zotonic/zotonic/apps/zotonic_core/src/db/z_db.erl"},{line,318}]},{z_db,q_row,3,[{file,"/home/zotonic/zotonic/apps/zotonic_core/src/db/z_db.erl"},{line,606}]},{m_identity,get_user_info,2,[{file,"/home/zotonic/zotonic/apps/zotonic_core/src/models/m_identity.erl"},{line,241}]}], text: "Stop request"
05:36:08.697 [info] z_db_pgsql:{286,5} SQL caller <0.7883.0> down with reason normal during on xxx/public: "
select key, visited, prop1, modified
from identity
where rsc_id = $1
and type = 'username_pw'" []
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.