Refactor apt_sources table

未关闭
#8,929 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
64/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
冷清
技术栈
cpp

调研方向

找到 apt_sources 表的实现及其 parseDeb822Block 入口点,然后阅读字段的收集方式以及 schema 的定义方式。重构求值过程,使字段顺序不会影响已禁用的块,并确保该表返回每个源以及支持筛选的 enabled 布尔值。

由索引模型根据 Issue 内容生成。

描述

Linux virtual tables wishlist

Blueprint

Greetings! 👋

#8928 fixed the apt_sources table incorrectly dropping deb822 source blocks that used yes as an affirmative value for the Enabled field. During review, a few deeper behavioral issues were noted that are worth addressing in a follow-up refactor.

Problems

1. parseDeb822Block is order-dependent, but deb822 is not

The current implementation returns early mid-loop when it encounters Enabled: no. This means the outcome depends on field order: for example, if Enabled: no appears after a malformed Types: or URIs: line, the function returns a failure instead of correctly treating the block as disabled.
See: #8928 (comment)

2. Silently omitting disabled sources is overly opinionated

Currently, any source with Enabled: no is silently dropped from results.
This makes the table less useful for auditing: users have no way to see which repos exist but are disabled. It can also be surprising and confusing.

Proposed Changes

  • Refactor parseDeb822Block to be order-independent: collect all fields first, then evaluate Enabled after the loop rather than as an early return
  • Add an enabled boolean column to the apt_sources schema and return all source entries regardless of their enabled state, allowing users to filter as needed (e.g. SELECT * FROM apt_sources WHERE enabled = 1)
主要语言
C++
星标
23.8k
派生
2.7k
平均合并
6 天 11 小时
30 天内合并 PR
69

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

osquery/osquery 的其他 Issue

查看 osquery/osquery 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。