aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Yang <aycyang@google.com>2023-05-24 11:24:23 -0700
committerAlex Yang <aycyang@google.com>2023-06-27 14:08:25 -0700
commit6d3334657180f3663b8d83636f4d1bc2097492d2 (patch)
treee19fccaf09c724eabc614df8de258c92375f6a91
parenttests: manually wrap libc functions (diff)
downloadwayland-6d3334657180f3663b8d83636f4d1bc2097492d2.tar
wayland-6d3334657180f3663b8d83636f4d1bc2097492d2.tar.gz
wayland-6d3334657180f3663b8d83636f4d1bc2097492d2.tar.bz2
wayland-6d3334657180f3663b8d83636f4d1bc2097492d2.tar.lz
wayland-6d3334657180f3663b8d83636f4d1bc2097492d2.tar.xz
wayland-6d3334657180f3663b8d83636f4d1bc2097492d2.tar.zst
wayland-6d3334657180f3663b8d83636f4d1bc2097492d2.zip
debug: Replace "@<id>" with "#<id>" in logs
Wayland debug logs resemble email addresses. This is a problem when anonymizing logs from users. For example: [2512874.343] xdg_surface@700.configure(333) In the above log line, the substring "surface@700.config" can be mistaken for an email address and redacted during anonymization. Signed-off-by: Alex Yang <aycyang@google.com>
-rw-r--r--src/connection.c6
-rw-r--r--src/wayland-client.c6
-rw-r--r--src/wayland-server.c8
-rw-r--r--tests/queue-test.c4
4 files changed, 12 insertions, 12 deletions
diff --git a/src/connection.c b/src/connection.c
index ceaeac1..8a2d9e9 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -1283,7 +1283,7 @@ wl_closure_print(struct wl_closure *closure, struct wl_object *target,
clock_gettime(CLOCK_REALTIME, &tp);
time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
- fprintf(f, "[%7u.%03u] %s%s%s@%u.%s(",
+ fprintf(f, "[%7u.%03u] %s%s%s#%u.%s(",
time / 1000, time % 1000,
discarded ? "discarded " : "",
send ? " -> " : "",
@@ -1323,7 +1323,7 @@ wl_closure_print(struct wl_closure *closure, struct wl_object *target,
break;
case 'o':
if (closure->args[i].o)
- fprintf(f, "%s@%u",
+ fprintf(f, "%s#%u",
closure->args[i].o->interface->name,
closure->args[i].o->id);
else
@@ -1335,7 +1335,7 @@ wl_closure_print(struct wl_closure *closure, struct wl_object *target,
else
nval = closure->args[i].n;
- fprintf(f, "new id %s@",
+ fprintf(f, "new id %s#",
(closure->message->types[i]) ?
closure->message->types[i]->name :
"[unknown]");
diff --git a/src/wayland-client.c b/src/wayland-client.c
index 105f9be..607fdb4 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -312,7 +312,7 @@ wl_event_queue_release(struct wl_event_queue *queue)
wl_list_for_each_safe(proxy, tmp, &queue->proxy_list,
queue_link) {
if (queue != &queue->display->default_queue) {
- wl_log(" %s@%u still attached\n",
+ wl_log(" %s#%u still attached\n",
proxy->object.interface->name,
proxy->object.id);
}
@@ -1045,7 +1045,7 @@ display_handle_error(void *data,
const struct wl_interface *interface;
if (proxy) {
- wl_log("%s@%u: error %d: %s\n",
+ wl_log("%s#%u: error %d: %s\n",
proxy->object.interface->name,
proxy->object.id,
code, message);
@@ -1526,7 +1526,7 @@ queue_event(struct wl_display *display, int len)
clock_gettime(CLOCK_REALTIME, &tp);
time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
- fprintf(stderr, "[%7u.%03u] discarded [%s]@%d.[event %d]"
+ fprintf(stderr, "[%7u.%03u] discarded [%s]#%d.[event %d]"
"(%d fd, %d byte)\n",
time / 1000, time % 1000,
zombie ? "zombie" : "unknown",
diff --git a/src/wayland-server.c b/src/wayland-server.c
index 2edf621..e784ef6 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -391,7 +391,7 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
if (opcode >= object->interface->method_count) {
wl_resource_post_error(client->display_resource,
WL_DISPLAY_ERROR_INVALID_METHOD,
- "invalid method %d, object %s@%u",
+ "invalid method %d, object %s#%u",
opcode,
object->interface->name,
object->id);
@@ -405,7 +405,7 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
wl_resource_post_error(client->display_resource,
WL_DISPLAY_ERROR_INVALID_METHOD,
"invalid method %d (since %d < %d)"
- ", object %s@%u",
+ ", object %s#%u",
opcode, resource->version, since,
object->interface->name,
object->id);
@@ -423,7 +423,7 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
wl_closure_lookup_objects(closure, &client->objects) < 0) {
wl_resource_post_error(client->display_resource,
WL_DISPLAY_ERROR_INVALID_METHOD,
- "invalid arguments for %s@%u.%s",
+ "invalid arguments for %s#%u.%s",
object->interface->name,
object->id,
message->name);
@@ -1343,7 +1343,7 @@ wl_global_remove(struct wl_global *global)
if (global->removed)
wl_abort("wl_global_remove: called twice on the same "
- "global '%s@%"PRIu32"'", global->interface->name,
+ "global '%s#%"PRIu32"'", global->interface->name,
global->name);
wl_list_for_each(resource, &display->registry_resource_list, link)
diff --git a/tests/queue-test.c b/tests/queue-test.c
index 4129310..6562139 100644
--- a/tests/queue-test.c
+++ b/tests/queue-test.c
@@ -383,7 +383,7 @@ client_test_queue_destroy_with_attached_proxies(void)
/* Check that the log contains some information about the attached
* wl_callback proxy. */
log = map_file(client_log_fd, &log_len);
- ret = snprintf(callback_name, sizeof(callback_name), "wl_callback@%u",
+ ret = snprintf(callback_name, sizeof(callback_name), "wl_callback#%u",
wl_proxy_get_id((struct wl_proxy *) callback));
assert(ret > 0 && ret < (int)sizeof(callback_name) &&
"callback name creation failed (possibly truncated)");
@@ -456,7 +456,7 @@ client_test_queue_destroy_default_with_attached_proxies(void)
/* Check that the log does not contain any warning about the attached
* wl_callback proxy. */
log = maybe_map_file(client_log_fd, &log_len);
- ret = snprintf(callback_name, sizeof(callback_name), "wl_callback@%u",
+ ret = snprintf(callback_name, sizeof(callback_name), "wl_callback#%u",
wl_proxy_get_id((struct wl_proxy *) callback));
assert(ret > 0 && ret < (int)sizeof(callback_name) &&
"callback name creation failed (possibly truncated)");