def extract_paths(actions):
  """
    <Purpose>
      Given a list of actions, it extracts all the absolute and relative paths
      from all the actions.

    <Arguments>
      actions: A list of actions from a parsed trace

    <Returns>
      absolute_paths: a list with all absolute paths extracted from the actions
      relative_paths: a list with all relative paths extracted from the actions

  """

  absolute_paths = []
  relative_paths = []

  actions_with_path = ['open', 'creat', 'statfs', 'access', 'stat', 
                        'link', 'unlink', 'chdir', 'rmdir', 'mkdir']

  for action in actions:
    # get the name of the syscall and remove the "_syscall" part at the end.
    action_name = action[0][:action[0].find("_syscall")]
    
    # we only care about actions containing paths
    if action_name not in actions_with_path:
      continue

    # we only care about paths that exist
    action_result = action[2]
    if action_result == (-1, 'ENOENT'):
      continue

    path = action[1][0]

    if path.startswith("/"):
      if path not in absolute_paths:
        absolute_paths.append(path)
    else:
      if path not in relative_paths:
        relative_paths.append(path)

    # get the second path of link
    if action_name == "link":
      path = action[1][1]

      if path.startswith("/"):
        if path not in absolute_paths:
          absolute_paths.append(path)
      else:
        if path not in relative_paths:
          relative_paths.append(path)


  return absolute_paths, relative_paths